constants. was Re: cobyla



On Wed, Jul 31, 2013 at 3:49 AM, Robert Dodier <robert.dodier at gmail.com>wrote:

> On 2013-07-30, Stavros Macrakis <macrakis at alum.mit.edu> wrote:
>
> > 1) What does it do for the naive user, the one who simply doesn't know
> that
> > %i, %pi, etc. have special meanings?
>
> Actually it seems best for them; they expect their %i, %pi, etc to act
> like an ordinary variable, and indeed it does.


Only in certain limited contexts.  If they try to name their variables %i,
%j, %k outside those contexts, they will have bizarre results.


> > 2) What does that do to the extremely common and very useful pattern of
> > (val: <expression involving x>, ..., operation(val, x) )?  In this
> > expression, <expression involving x> is not within the scope of
> operation's
> > x.
>
> Yeah -- an implicit lexical environment for integrate, plot2d, etc
>  
> doesn't extend to these common, useful o
> 
> perations.
>
> > 3) If a %pi leaks, how do we distinguish it from other %pi's?
>
> Well, it's the one that doesn't have any interesting properties.
>
> > 4) Binding constant symbols seems to be a small detail in your grand
> > scheme.  Let's figure out how to handle x and y first, then we can worry
> > about %i and %pi.
>
> Incidentally, it's not "my" scheme -- I'm surely not the first or last
>  
> to bring up lexical scop
> 
> e, and not even the one who raised it in the
>  
> current iteration.


Fair enough.  I have also raised it in the past.


> Associating ideas with people is problematic -- it
>  
> makes is more difficult to be critical of the idea since the criticism
>  
> seems to carry over to the person as well.


True, I wouldn't want to contaminate the idea with your reputation. :-)


> And one might change his mind
>  
> as the discussion progresses, so that which was once "his" idea isn
> 
> 't
>  
> anymore.
>
> Anyway I'm beginning to think any implicit lexical environment is likely
> to be too hard to understand. An explicit lexical environment would
> solve the name collision problem, and make it clear which symbols are
> affected (so if a leaked symbol has different properties, at least it
> isn't a surprise), and could also enclose all of the stuff that's relevant
> (addressing item (2) above).
>
> To return to plot2d, where we started a day or two ago, at this point
> I'm inclined to say trying to use a constant should trigger a complaint.
> (Actually COERCE-FLOAT-FUN should probably just use MSETQ to assign
> a value -- that will trigger any complaints which assignment triggers.
> There may be other kinds of forbidden assignments detected by MSETQ.)
> Let the user enclose plot2d in a lexical environment if they want to
> use a symbol which already has special properties. We'll want to create
> a lexical environment for general use. As a proof of concept, consider
> blex. [http://www.math.utexas.edu/pipermail/maxima/2012/029643.html]
>
> best
>
> Robert Dodier
>
> _______________________________________________
> Maxima mailing list
> Maxima at math.utexas.edu
> http://www.math.utexas.edu/mailman/listinfo/maxima
>