From: Matt C. <mr...@Le...> - 2003-09-20 06:03:12
|
Response.. >>Can you declare variables, if so, how? For example if I have a global > 'x', the only way I can override it in a function is to have x be the >>name of a parameter. > > Not true; take my example below: > > function dostuff(y, z) > x = 5 > print x * 5 # Prints 25 > end function > x = 10 > dostuff(5, 10) > > Or were you saying that that is the way you'd like it to be? Not totally sure here. I either disagree with you here, or my statement wasn't clear. In your code sample, in my opinion, everything not inside a function is run right when that script file is opened. Things inside functions are saved for later parsing. Thus, when it sees x = 5, it's in context of the already defined x (=10) and not in context of the order in which they were declared. This it thinks that you're trying to set the global. This is part of the reason I'm afraid of having code outside of functions... the order that it's parsed and executed is muddled (from my view, though perhaps it's clear to you). >>Since there is no type for variables, concatenation should be an >>operator (either '.' or '&', I think) > > I support '.', personally. Me too. > Comments are preceded with # (is this okay?) and can be at the start of a line or at the end of one. That's fine >>Also, I think it should be possible to attach a string to each >>function describing it, so that in the console, you could do 'lsfunc' >>or something, and get: >>function1() - Does xyz >>function2() - Does abc >>I think it would be a neat thing to add (and optional, of course). > > Yeah, sure, I like this well enough.. maybe it looks for the line of comments immedietly preceding the function definition or something, but we can work that out. Yeah, that's what I was thinking |