Hi Peter!

I see you are really motivated for having types in Pharo. This is great.
The email you’ve sent a couple of days ago motivated me for continuing my 
effort.

The two important design points of my implementation are as follow:
        (A) - Types are specified in the method comment. Consider the following 
two examples:
-=-=-=-=-=-=-=-=-=-=-=-=
RBParser class>>parseMethod: aString
"
:: String -> RBProgramNode
“
...
-=-=-=-=-=-=-=-=-=-=-=-=
The method parseMethod: accepts a string as argument and return a program node

-=-=-=-=-=-=-=-=-=-=-=-=
exampleLabelledIf
        "
        var b: RTPieBuilder
        var c: Class
        “
        | b c |
…
-=-=-=-=-=-=-=-=-=-=-=-=
The method exampleLabelledIf defines two temporary variables, b and c. The 
comment defines the types of these variables

        (B) - I am still unsure which types system to use. Probably I will use 
the one of Dart for now. It is easy to implement but it is unsound. I think 
having a Gradual Type checker for Pharo would be fantastic, but this is 
seriously more complicated to have. 

All in all, there is a fair amount of non-trivial theory behind. Does this make 
sense to you? 

Cheers,
Alexandre


> On Oct 2, 2015, at 3:50 PM, Peter Uhnák <i.uh...@gmail.com> wrote:
> 
> Hi,
> 
> What options do we have in terms of type annotations in Pharo?
> 
> I stumbled upon TypePlug this 
> https://marcusdenker.de/talks/08ParisTypes/08ParisTypePlug.pdf (or rather 
> this http://scg.unibe.ch/archive/masters/Hald07a.pdf )
> 
> which enabled type annotation for Squeak such as
> ~~~~~~~~~~~~~~~~
> Fruit>>mixWith: aFruit <:type: Fruit :>
>     ^ (Array with: self with: aFruit) <:type: Array E: Fruit :>
> ~~~~~~~~~~~~~~~~
> Orange>>color
>     ^ (Color orange) <:type: Color :>
> ~~~~~~~~~~~~~~~~
> (or even blocks)
> [ :a1 <:type: Integer :> :a2 <:type: Integer :> | a1 + a2 ]
> ~~~~~~~~~~~~~~~~
> 
> obviously something like this wouldn't even compile in Pharo (does Sqeak have 
> different syntax for pragmas, or did the TypePlug change the syntax?)
> 
> And my question is... is there a port of this, or something similar?
> 
> I've also found this 
> http://randycoulman.com/blog/2013/02/12/specifying-types-for-smalltalk-fit/
> Which is a framework for integrated testing that uses pragmas such as
> ~~~~~~~~~~~~~~~~
> makeBatchWithdrawalOn: aDate note: aString
>   <fitTakes: #(#{Date} #{String})>
>   <fitReturns: #{Fixture}>
>   ^(BatchWithdrawalFixture date: aDate note: aString)
>       systemUnderTest: systemUnderTest
> ~~~~~~~~~~~~~~~~
> 
> Right now I am exploring what options we have in Pharo in terms of type 
> annotations (before writing yet-another-library ;-)).
> 
> Thanks,
> Peter

-- 
_,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:
Alexandre Bergel  http://www.bergel.eu
^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.




Reply via email to