> On 02 Oct 2015, at 20:50, 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 
> <https://marcusdenker.de/talks/08ParisTypes/08ParisTypePlug.pdf> (or rather 
> this http://scg.unibe.ch/archive/masters/Hald07a.pdf 
> <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?)
> 

This was based on a hacked compiler (using a smack grammar on top of a code 
generator based on RB Nodes similar to the one we have now in
Opal). We changed the grammar to parse these kind of annotations.

        Marcus

Reply via email to