Re: [stack] What does "concatenative" actually mean?
William Tanksley <[email protected]>
| Newsgroups | gmane.comp.lang.concatenative |
|---|---|
| Message-ID | <1236108236.5247.26851.camel@tanksley> |
Rodney D Price wrote: > can avoid having type IO <something>. There's no > escape from the IO monad in Haskell. Lacking a static > type system, Joy offers no such guarantee. Actually, Joy has a dynamic type system that DOES make that guarantee. That "F" type on the output of 'read' means that it truly is a file, and the only way to muck with it is through the file itself. > Cat, OTOH, has a Hindley-Milner static type system. > Perhaps Cat could do monads. My claim was that the stack is already a monad, so that nothing further was needed. John pointed out correctly that it was also important to return the thing whose state was being modified (thank you, you're absolutely correct). I'd now add that you have to have some assurance that there aren't references to the same state being manipulated "at the same time". That must be provided by the language's copy and reference semantics, as well as the semantics of the library responsible for state mutation (in this example, the I/O library). I think this means -- in general -- that you have to have custom code run when duplication and/or destruction happens. In specific, the optimizer has to either know about your mutable types, or be completely naive. And here's another difference between pure functional languages and concatenative languages, as a class: a naive implementation of a concatenative language (i.e. without any optimizer whatsoever) will run code reasonably quickly. Forth is a prime example; Joy is somewhat of an example, although its extensive use of functional abilities slows it down a bit. > -Rod -Wm