It's different because evaluated only once, either at method compilation or at first execution (lazy initialization). Nicolas 2010/7/22 Stéphane Ducasse <stephane.ducasse@inria.fr>
how different from
{ 'ac'->23 . 2->'casd' }
Stef
On Jul 22, 2010, at 2:09 PM, Sudhakar Krishnamachari wrote:
Would this be of interest in general... I have always wanted a more capable literal array than what we have now..
#( 123 23 'das' ) whynot: #( 'ac'->23 2->'casd' myVar1) ... evaluates to a collection..
so I just tried this out with a BlockClosure:
asArray
| stmts anArray |
stmts := self decompile statements. anArray := Array new: stmts size. stmts doWithIndex: [ :eaNode :indx| | start end value| start := (eaNode asString indexOf: ${)+1. end := (eaNode asString lastIndexOf: $})-1. value := Compiler evaluate: (eaNode asString copyFrom: start to: end) for: self receiver logged: false. anArray at: indx put: value]. ^anArray
So we could do: ['abc'->123. 'def'->456. 'efg'->789. 'hij'->123. 'klm'->456.] asArray. [self checkThisUsingKeywordMethod: 'abc' with:'efg'. localVar1. instanceVar1 ] asArray
to yield arrays.. not neat, I would much rather prefer the literals do their job their way... but works.. for the narrow set I have tried so far..
Any comments.. -Skrish
_______________________________________________ Pharo-project mailing list Pharo-project@lists.gforge.inria.fr http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
_______________________________________________ Pharo-project mailing list Pharo-project@lists.gforge.inria.fr http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project