Re: Re: geant: notion of local variables

Jocelyn <[email protected]> Sat, 02 Feb 2008 19:06:54 +0100
Newsgroups gmane.comp.lang.eiffel.gobo.general,gmane.comp.lang.eiffel.gobo.devel
Message-ID <[email protected]>
I agree that  <local ../> would be nicer than <setlocal ... />

but then .. do we consider <local ../> as local declaration, as 
<argument ... />
and in this case  <set /> and <unset />  would find itself, if they 
apply to local or global ?
And if we use <local /> as declaration, do we allow  unset variable ?
I mean ...

    <local name="test" />
    <echo message="$$test is not set" unless="$test" />
in this case I guess it is better to allow not set local variable.

we could even use  <local name="test" value="foobar" />  to initialize 
directly

If this is fill everyone's expectation, I can change my patch to have this.

and yes, local will bring better geant scripts :)
more than once, I got trapped by those awful global variable ;)

of course I would prefer to have   <set .. /> by default for local 
variables, and use  a <global name="varname" /> 
but this would break existing code...


--Jocelyn

On 2/2/2008 18:51 PM, Sven Ehrke wrote:
> Yes, I am still around :-)
>
> I would find it very useful to have local variables in geant.
> Note that I did not look into the the details of the patch.
> But what would you think about naming the task <local> instead
> of <setlocal> (just because of the similarity to Eiffel)?
>
> Also I could imagine that <unset> could be
> smart enough to find out itself if it is a local variable or
> a global one.
>
> Actually a long time ago I thought about implementing local variables
> myself but never took the time to do so. But the my feeling was the
> if local variables are supported all (or at least most) of the globals 
> could be
> eliminated and be replaced by locals and parameters which should 
> improve the
> scripts a lot.
>
> Eric Bezault wrote:
>> Hi Jocelyn,
>>
>> Somehow I didn't receive the original message that you sent on
>> January 31rst. I'm glad you copied it below. If Sven has no
>> objection about this addition to geant, then I'm fine with it.
>> Note that I didn't review your code below, but I guess that
>> you know the code of geant better than I do these days.
>>
>> It has been a long time since we didn't hear from Sven in the
>> Gobo mailing lists. Sven, are you still here?
>>
>
>
>