Page 1 of 1

Bug in fn parameters

Posted: Sat Jul 07, 2007 1:23 pm
by Jeff
Many characters are automatically split from symbols in parameter lists. For example,

Code: Select all

(foo bar ,baz :bat)
expands its parameter list to:

Code: Select all

(bar , baz : bat)
(5 parameters, rather than three)

This is bad behavior. It happens even in a macro. Perhaps commas could be excepted, as they are convention in newLisp, but probably it's a bug in the code, rather than an intended behavior.

Edit: this occurs in both stable 9.1 and 9.1.7 on osx 10.4.

Posted: Sat Jul 07, 2007 5:51 pm
by jrh
Section 1 of the newLISP Function Reference portion of the manual disallows the comma as the start of a variable name. Both commas and colons are prohibited from being inside a variable name as they are used to mark the end of a symbol.

The manual seems to imply that the colon is a legal start character though.

Posted: Sat Jul 07, 2007 5:57 pm
by Lutz
this is intended and documented here:

http://newlisp.org/downloads/newlisp_manual.html#commas

Same for the colon ':' . You could use this to define special operators. E.g. I have used this definition for the colon to make a shorter to type hash functionality:

Code: Select all

(constant (global ':) context)

(: 'Foo "x" 123)
(: Foo "x") => 123
also puts a lot of smileys in your code ;-)

Lutz

Posted: Sat Jul 07, 2007 5:58 pm
by Lutz
The manual seems to imply that the colon is a legal start character though
see also here:

http://newlisp.org/downloads/newlisp_ma ... mbol_names

Lutz

Posted: Sat Jul 07, 2007 7:16 pm
by Jeff
So there is no good way to emulate the common lisp backtick/comma use to create function templates apart from using lengthy expand expressions?

Posted: Sat Jul 07, 2007 7:37 pm
by Lutz
No, but perhaps you can find a way to built templates with letex and expand? Perhaps they come out lengthier but (for my taste ;-) ) better readable and understandable.

Lutz

Posted: Sun Jul 08, 2007 4:04 am
by rickyboy
Jeff wrote:So there is no good way to emulate the common lisp backtick/comma use to create function templates apart from using lengthy expand expressions?
Hi Jeff!

Yes there is a way to do this. Lutz, Dmi and I discussed this a little over a year ago. Maybe you can write something better (in particular, faster).

--Rick