On Thursday, April 25, 2002, at 09:03 pm, Geir Magnusson Jr. wrote:
> On 4/25/02 3:38 PM, "Barbara Baughman" <[EMAIL PROTECTED]> wrote:
>
>> Sorry, but I just don't have time to download & give it a whirl right
>> now. Just curious if #set($foo="") works.
>
> :)
>
> Yes. It didn't at first, I will confess...
It does work now, but now these are equivalent:
#set( $foo='' )
#set( $foo="" )
#set( $foo='''' )
#set( $foo="""" )
#set( $foo="""""""""""""""""""""""""" )
I would qualify this as a bug ;-)
--->8---
>>>> Perhaps we should use a dedicated string concatenation operator
>>>> instead. Perhaps + seems natural after Java and C++, but do we want
>>>> to
>>>> use operator overloading? I mean, that the meaning of + depends on
>>>> the
>>>> type of it's arguments. 1 + 1 == 2 but '1' + '1' == '11'. And what
>>>> about
>>>> '1' + 1 then? This is complicated, and I think it is somewhat
>>>> confusing
>>>> for non-programmers.
>>>
>>> Well.
>>>
>>> '1' + 1 => error, which is what it is now
You can do like that:
#set( $num=1 )
#set( $str='1' )
#set( $cat=$str + "$num" )
If the designer sees that the output is not quite what was expected, it
is not too hard to add quotes wherever is needed.
>>> The only thing I can imagine is ".", but that�s about as intuitive
>>> as '+'.
>>> Of course, it's nice because it's not overloaded....
I think + is good enough.
Other ideas:
#set( $foo=("Vel", $blah) )
#set( $foo="Vel" ^ $blah )
#set( $foo="Vel" # $blah )
-- Denis.
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>