Surprising that a sequence is not an expression. I'm pretty sure that (1+2. 2+3) is an expression that returns 5 (after computing a useless addition). What is currently not an expression is the variable declaration, indeed. But if we make |d| an expression then that means we can declare variables in the middle of a sequence… so it would still have the same lifetime, but a shorter scope ?
On 30 June 2017 at 11:32, Stephane Ducasse <[email protected]> wrote: > I do not get why (Yes I know it is because it is not in the syntax.... > but it is conceptually not nice). > > | d | > d := Dictionary new. > d at: #top at: #below1 put: 1. > d at: #top at: #below1 put: 2. > d at: #top at: #below1. > > is not an expression in Pharo. > > It means that I can manipulate > > 1 + 3, > x + 3 as an expression > but not a sequence. > > So it forces me to use a block to convert artificially a sequence > in an expression. > > [ > | d | > d := Dictionary new. > d at: #top at: #below1 put: 1. > d at: #top at: #below1 put: 2. > d at: #top at: #below1. > ] value > > So if I want to build a repl executing expression then this is not a > Pharo repl but just a stupid expression. > > I would like to know what would be impact to have sequence and > declaration as expression. > > Stef > > -- Damien Pollet type less, do more [ | ] http://people.untyped.org/damien.pollet
