Hi Jan, > On Jan 11, 2017, at 4:54 PM, Jan Vrany <[email protected]> wrote: > > Hi, I'm afraid this is not specified. There's no > language specification (*) as such of Pharo or any > other available smalltalk - at least not that I know > (prove me if I'm wrong).
Wow, I just skimmed the messages section in the blue book and you're right. I think this is an omission and that it should be specified that keyword message receiver and arguments are evaluated strictly left-to-right. I don't know of a Smalltalk implementation that doesn't evaluate in this order. But thanks for the OP's question and for your response. I am surprised. > > Order in which subexpressions are evaluated is rarely specified. > IIRC, JVM Spec doesn't specify it either. > > If the question was rather "How does it work in current Pharo > implementation?", then it's easy to check, just add some sideffects > to subexpressions (like Transcript show) and see in what order > they're executed :-) > > (*) Specification in a sense of Java Language Spec, > C# Language Specification, C99 Spec and so on. > > Jan > >> On Wed, 2017-01-11 at 16:16 -0800, James Ladd wrote: >> Hi Pharo People, >> >> I know Smalltalk has precedence rules when subexpressions () are >> involved. >> >> 2 + ( (3 * 4) - 1 ) >> evaluated last ( (evaluated first) evaluated second ) >> >> That is the inner most subexpression is evaluated first. >> >> Given the following made up expression for the purposes of my >> question: >> >> self at: (self offset) - 1 put: (2 * (12 / 4)). >> >> Are there precedence rules for the subexpressions that are part of >> the >> keyword expression? >> ie: Should (self offset) - 1 be evaluated before (2 * (12 / 4)). >> >> My thinking is that with keywords the arguments are evaluated left to >> right >> - that is >> at: before put: but within each the regular subexpression precedence >> applies? >> >> - James. >> >> >> >> >> >> >> -- >> View this message in context: http://forum.world.st/subexpression-pre >> cedence-tp4929398.html >> Sent from the Pharo Smalltalk Developers mailing list archive at >> Nabble.com. _,,,^..^,,,_ (phone)
