Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

#95 A block whose variables are local unless stated?

open
nobody
None
5
2012-11-18
2012-02-08
Edd Barrett
No

I spent a long time debugging maxima program today to find that variables within a function are by default global -- I was being bitten by variable name clashes. This was not what I was expecting (having come from a C/Python background).

I found in the manual:
block([locals], expr1, ... , exprn)

Which is a great help, but how about a block whose variables are *all local* unless specified global? This is the safe default I would have expected -- but then I am not a mathematician.

Or is that just wacky?

Discussion