[sr-dev] git:andrei/rve_f_params: NEWS: notes about expressions in function parameters

Klaus Darilion klaus.mailinglists at pernau.at
Thu Aug 12 09:26:20 CEST 2010


forgot to cc the list...

Am 11.08.2010 20:11, schrieb Andrei Pelinescu-Onciul:
> On Aug 11, 2010 at 18:39, Klaus Darilion<klaus.mailinglists at pernau.at>  wrote:
>>
>>
>> Am 11.08.2010 17:19, schrieb Andrei Pelinescu-Onciul:
>>> On Aug 11, 2010 at 17:13, Klaus Darilion<klaus.mailinglists at pernau.at>   wrote:
>>>> Hi Andrei!
>>>>
>>>> Am 11.08.2010 16:18, schrieb Andrei Pelinescu-Onciul:
>>>>> +  - all the module functions can now be called with any constant expression
>>>>> +      as parameters. E.g.: f("7 *" +" 6 = " + 7 * 6);
>>>>
>>>> What is the result of this example?
>>>
>>> f("7 * 6 =  42")
>>
>>
>> ... + 7 * 6)
>>      ^   ^
>>      |   |
>>      A   B
>>
>> IMO it is very confusing (if not even wrong) that A is a string
>> concat and B is a arithmetic operation. What happens with:
>>
>> ... + 7 + 6) ?
>
> f("7 + 6 = 76") :-)
>
> but
>
> f("7 +" +" 6 = " + (7 + 6)) is f("7 + 6 = 13"), as expected.
>
> I agree it's confusing, but when I wanted to add a separate operator for
> string concat (e.g. '.') lots of people opposed it on the grounds that
> it will be too difficult for a script writer to use 2 different operators
>   (or something similar).
> Now we have auto-conversion everywhere...
>
> Maybe we can revisit this and the option of declaring only typed
> variable for a future release.

I can't remember if I was for or against a dedicated concat parameter, 
but now I think a dedicated parameter would be good. '.' might be 
confusing as well once we support float numbers.

Is it possible to analyze how sr evaluates the term?

regards
klaus



More information about the sr-dev mailing list