Live data from Hacker News

Dragonfly 0.60 - a newLisp web framework

rundragonfly.com

11–18 of 18 posts

Re: Dragonfly 0.60 - a newLisp web framework

#11

Earlier quoted context omitted.

The word "troll" used to mean something very specific: A person who would post opinions that he or she didn't actually hold, but which were very likely to result in comical outrage from others. The modern meaning seems to have drifted towards "someone who disagrees with me" :( In any case, I don't care too much about making up peoples' minds for them. A great deal has already been written about how dynamic scope is a…

Sorry, by "troll" I meant someone who spreads misinformation, whether deliberately or unknowingly through ignorance. Perhaps I'm misusing the word, if so, my apologies. A great deal has already been written about how dynamic scope is a Bad Thing. What most people don't like about dynamic scope has to do with its use in compiled languages. newLISP isn't compiled and so many of those criticisms aren't applicable. Dynam…

My issues (and I think most peoples' issues) with dynamic scope have nothing to do with being compiled or interpreted. From wikipedia (http://en.wikipedia.org/wiki/Scope_%28programming%29#Dynamic...):

"However, this benefit relies on careful documentation of all variables used this way as well as on careful avoidance of assumptions about a variable's behavior, and does not provide any mechanism to detect interference between different parts of a program. As such, dynamic scoping can be dangerous and almost no modern languages use it."

Re: Dragonfly 0.60 - a newLisp web framework

#12

Earlier quoted context omitted.

Sorry, by "troll" I meant someone who spreads misinformation, whether deliberately or unknowingly through ignorance. Perhaps I'm misusing the word, if so, my apologies. A great deal has already been written about how dynamic scope is a Bad Thing. What most people don't like about dynamic scope has to do with its use in compiled languages. newLISP isn't compiled and so many of those criticisms aren't applicable. Dynam…

My issues (and I think most peoples' issues) with dynamic scope have nothing to do with being compiled or interpreted. From wikipedia ( http://en.wikipedia.org/wiki/Scope_%28programming%29#Dynamic... ): "However, this benefit relies on careful documentation of all variables used this way as well as on careful avoidance of assumptions about a variable's behavior, and does not provide any mechanism to detect interferen…

OK, but that paragraph doesn't provide a practical example of what it's talking about, so I'll provide one here:

  (define (my-unpredictable-func)
	(println a))
In that function the value of the symbol 'a' will change depending on the context the function is called in. This is called an "unbounded symbol" (or something along those lines), and it is the thing that paragraph is referring to. It is true that it is not safe to write code like this, and so most newLISP code doesn't do this.

The proper way to write the function in newLISP is like so:

  (define (my-predictable-func a)
	(println a))
Here it is plain and obvious what the value of 'a' will be: whatever is passed into the function. This is how most newLISP code is written, and it works, and it's safe, and it's fast. If newLISP used lexical scope you would be complaining about how slow it was.

In very rare circumstances, you may need some lexical construct, in which case you have the functions 'letex' and 'expand' available to you.

From this example you can see that this isn't a "show stopper" but something to simply be aware of. Sortof how dereferencing NULL pointers in C is a possibility, but not a show stopper.

Re: Dragonfly 0.60 - a newLisp web framework

#13
post #3

Cool post, I never new about newLISP before this; just checked out the language and it looks really cool!

Beware. It isn't cool. It rehashes some awful mistakes that were made in the design of early Lisp languages - in particular dynamic scope. It's a shame, as some effort has clearly been put in to making newLisp something that people can get up-and-running with very quickly. But with the language itself being broken, this effort is wasted.

In my opinion, dynamic scope is adequate solution for Lisp approach, i.e. expressive power on the first place. Newlisp is very simple and expressive dialect, and it is pleasure using it. Dynamic scope allow some things statical scope doesn't. Sure, the price for that expressive power is that one has to be more careful, but this is not really that hard, and it shouldn't be the problem to anyone who really accept basic Lisp ideas.

I can see how dynamic scope - just like dynamic typing, eval or macros - could be seen as problem for people who want language like, say, Ada that puts safety on the first place. It is legitimate position. But it is not design goal or tradition of Lisp. Lisp is designed for AI, exploratory programming, hacking, expressive power, adventure. Owner of this site, Paul Graham, frequently wrote in that vein. It is simply not consistent to brag about expressive power of Lisp, and then turn into safety freak when one mentions dynamic scope.

OK safety freak is maybe too strong, but you get the point.

Re: Dragonfly 0.60 - a newLisp web framework

#14

Earlier quoted context omitted.

Beware. It isn't cool. It rehashes some awful mistakes that were made in the design of early Lisp languages - in particular dynamic scope. It's a shame, as some effort has clearly been put in to making newLisp something that people can get up-and-running with very quickly. But with the language itself being broken, this effort is wasted.

In my opinion, dynamic scope is adequate solution for Lisp approach, i.e. expressive power on the first place. Newlisp is very simple and expressive dialect, and it is pleasure using it. Dynamic scope allow some things statical scope doesn't. Sure, the price for that expressive power is that one has to be more careful, but this is not really that hard, and it shouldn't be the problem to anyone who really accept basic…

Dynamic scope is a decrease in expressive power. You don't get closures.

Re: Dragonfly 0.60 - a newLisp web framework

#15

Earlier quoted context omitted.

Sorry, by "troll" I meant someone who spreads misinformation, whether deliberately or unknowingly through ignorance. Perhaps I'm misusing the word, if so, my apologies. A great deal has already been written about how dynamic scope is a Bad Thing. What most people don't like about dynamic scope has to do with its use in compiled languages. newLISP isn't compiled and so many of those criticisms aren't applicable. Dynam…

My issues (and I think most peoples' issues) with dynamic scope have nothing to do with being compiled or interpreted. From wikipedia ( http://en.wikipedia.org/wiki/Scope_%28programming%29#Dynamic... ): "However, this benefit relies on careful documentation of all variables used this way as well as on careful avoidance of assumptions about a variable's behavior, and does not provide any mechanism to detect interferen…

This problem exists, but it is equivalent to problems Common Lisp programmer has to face if he writes macros, and solutions are similar. In CL it is solved with gensyms, and Scheme hygienic macros automatised that. Similar approaches are possible - and practiced - in Newlisp.

Re: Dragonfly 0.60 - a newLisp web framework

#16
post #14

Earlier quoted context omitted.

In my opinion, dynamic scope is adequate solution for Lisp approach, i.e. expressive power on the first place. Newlisp is very simple and expressive dialect, and it is pleasure using it. Dynamic scope allow some things statical scope doesn't. Sure, the price for that expressive power is that one has to be more careful, but this is not really that hard, and it shouldn't be the problem to anyone who really accept basic…

Dynamic scope is a decrease in expressive power. You don't get closures.

PG on newLisp a long time ago

"I took a quick look at it. It looked to me as if the way you're supposed to avoid variable capture is to use variables with unusual names. Is this really the plan? What about expansions that occur within expansions?"

http://lambda-the-ultimate.org/node/257#comment-1889

Re: Dragonfly 0.60 - a newLisp web framework

#17
post #14

Earlier quoted context omitted.

Dynamic scope is a decrease in expressive power. You don't get closures.

PG on newLisp a long time ago "I took a quick look at it. It looked to me as if the way you're supposed to avoid variable capture is to use variables with unusual names. Is this really the plan? What about expansions that occur within expansions?" http://lambda-the-ultimate.org/node/257#comment-1889

There are few ways out of that:

1. use of "contexts" i.e. Newlisp namespaces

2. use of same approach as in CL or Scheme macros. In CL it is automatic generation of unusual names, gensyms, in Scheme it is even more automatic "hygiene". Both of these approaches are available in Newlisp as well. One can check my blog post at: http://kazimirmajorinc.blogspot.com/2009/12/symbols-as-sexpr... It is not simple reading if one didn't used dynamic scope, but essentially it is how one can write hygienic fexprs (Newlisp macros are actually fexprs).

3. use of some "OO" additions. I am bit of OO sceptic, but for those who are not, there are at least two OO systems for Newlisp.

3.1. Official FOOP system, still in development http://newlispfanclub.alh.net/forum/viewtopic.php?f=2&t=...

3.2. Greg's OO system http://www.taoeffect.com/blog/2009/12/introducing-objective-...

Re: Dragonfly 0.60 - a newLisp web framework

#18
post #14

Earlier quoted context omitted.

In my opinion, dynamic scope is adequate solution for Lisp approach, i.e. expressive power on the first place. Newlisp is very simple and expressive dialect, and it is pleasure using it. Dynamic scope allow some things statical scope doesn't. Sure, the price for that expressive power is that one has to be more careful, but this is not really that hard, and it shouldn't be the problem to anyone who really accept basic…

Dynamic scope is a decrease in expressive power. You don't get closures.

Closures are the functions with "private" data preserving values between two calls of the same function. It is not impossible with dynamic scope - but problem is again accidental name clash. As it is the same problem as with macros - I guess it can be solved on similar way - using functions with generated unusual and unique names of variables.

On the other side, with dynamic scope, functions are as expressive (or almost) as macros and they are the first class values. For example, one can implement "if" as a function. http://kazimirmajorinc.blogspot.com/2009/01/two-definitions-...

Post reply on HN