On Mar 17, 2011, at 2:04 PM, Alan wrote:

> On Mar 17, 11:00 am, Meikel Brandmeyer <m...@kotka.de> wrote:
>> Hi,
>> 
>> Am 17.03.2011 um 18:11 schrieb Alan:
>> 
>>> From my uninformed position, strint looks like it should have been
>>> written as a function, not a macro, but probably there are reasons it
>>> was not.
>> 
>> It can't be „simply“ a function, because then it has no access to the local 
>> environment.
>> 
>> (let [x 99]
>>   (<< "~x bottles of beer"))
>> 
>> This does not work if << is a function. You could imagine a function taking 
>> a map with bindings.
>> 
>> (<< "~x bottles of beer" {:x 99})
>> 
>> But then: why not use format in the first place?
>> 
>> Sincerely
>> Meikel
> 
> See? Told you there was an excellent reason I was wrong!

Indeed, my objective with strint was to – outside of the simple concatenation 
of string constants and runtime values – have the interpolation happen at 
compile-time, not runtime.  Thus, a macro. :-)

- Chas

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Reply via email to