[Pharo-dev] String Interpolation

Denis Kudriashov dionisiydk at gmail.com
Wed Oct 4 15:49:58 EDT 2017


2017-10-04 21:38 GMT+02:00 Esteban A. Maringolo <emaringolo at gmail.com>:

> 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?
>

What the problem? This message is a tool. You use it when you need it. When
you modify the method the value is cleaned.
Nice thing is that it not requires special syntax. And you can debug
expression as normal part of method.


>
> 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/21c46635/attachment-0002.html>


More information about the Pharo-dev mailing list