Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

FORTH is very different from LISP but it's very similar in that you can use the quote operator to write control structures the same way you write any other function.

Common LISP had CLOS that implemented object-oriented programming in a style not too different from Python, but as a library without compiler support and that was also true for late 1980s FORTH.



> but as a library without compiler support

I'm not sure what you mean by this;As part of CL, CLOS always had compiler (and run time compiler) support.

Many early OO systems were implemented in lisps, partially because they are flexible enough to add language features reasonably well, by default. See, e.g. Flavors, Loops. These predate CL and influenced the design of CLOS.


> can use the quote operator to write control structures

The quote operator cannot be used for writing control structures in Lisp, unless we are referring to something you generally should not do in production code, like:

  (defun meta-circular-if (cond then else)
    (if (eval cond) (eval then) (eval else)))

  (meta-circular-if (quote (> 3 2)) (quote (+ 4 4)) 0)
Quoting is nothing like referring to Forth words as data. When Forth code refers to a Forth word foo, that's more like (function foo) than (quote foo).


> The quote operator cannot be used for writing control structures in Lisp

I'm not sure this is what they had in mind, but I've actually done pretty much this when bootstrapping. Eg:

  (def (do-if cond)  # actually a built-in, but defined this way
    (if cond id quote))
  ((do-if tee) (foo))  # (id (foo))
  ((do-if nil) (bar))  # (quote (bar))


CLOS generics+methods style is actually quite a different model in some ways from the Smalltalk-like model Python runs on! Primarily, method dispatch has the generic function primary and the classes secondary: methods are separately-definable specializations of what would otherwise be functions, rather than “owned” by a receiver object via its class. There was a recent item on Python versus CL: https://news.ycombinator.com/item?id=27011942


I can't find a link to it at the moment, but Pierre de Lacaze gave an excellent talk about the CLOS/MOP systems at Lisp NYC about 5 years ago. If anyone is interested in these topics, I'd recommend digging around to see if you can find it.


The Python object model is quite unlike CLOS.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: