Ah maybe, I interpreted literal literally. Let Sudhakar talk... Nicolas
2010/7/22 Stéphane Ducasse <[email protected]> > > On Jul 22, 2010, at 2:33 PM, Nicolas Cellier wrote: > > > It's different because evaluated only once, either at method compilation > or at first execution (lazy initialization). > > but Sudhakar use case did not show that he wanted something different. > or I totally do not understand. > > > > #( 123 23 'das' ) > > > whynot: > > > #( 'ac'->23 2->'casd' myVar1) ... evaluates to a collection.. > > > > > > 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 > > > [email protected] > > > http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project > > > > > > _______________________________________________ > > Pharo-project mailing list > > [email protected] > > http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project > > > > _______________________________________________ > > Pharo-project mailing list > > [email protected] > > http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project > > > _______________________________________________ > Pharo-project mailing list > [email protected] > http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project >
_______________________________________________ Pharo-project mailing list [email protected] http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
