[Pharo-dev] String Interpolation

Esteban A. Maringolo emaringolo at gmail.com
Wed Oct 4 15:38:00 EDT 2017


2017-10-04 6:46 GMT-03:00 Denis Kudriashov <dionisiydk at gmail.com>:

> Hi Igor.
>
> Did you see that we have now #asMethodConstant?
>
> DateAndTime now asMethodConst
>
>
> It is not compiled time but behaviour is very close to it.
> The trick is that first time execution will replace full expression with
> the result as literal (the receiver of #asMethodConst). So at second time
> it will be just literal reading.
>
>
It is weird that a regular message send makes the returned value a method
constant.
How is that cleaned up? Do I have to search for all the methods that
contain such message send?

Dolphin had the ##() syntax, which basically creates a method constant, but
it is evaluated right away.

So you could write the seconds in a day as ##(60*60*24), or, of course, any
more complex expression. But the difference is that it is resolved at
compile time.

However I don't see how this relates with the String interpolation :)

Esteban A. Maringolo
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.pharo.org/pipermail/pharo-dev_lists.pharo.org/attachments/20171004/dd57b084/attachment-0002.html>


More information about the Pharo-dev mailing list