Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

I'm implementing a Lisp

Name: Anonymous 2011-12-24 23:32

Discuss how the perfect module/namespace should behave.  Keep in mind things like multimethods (which should be merge rather than shadow).

Name: Anonymous 2011-12-24 23:46

It should behave like Java's module/namespace system

Name: Anonymous 2011-12-24 23:50

>>1
I'm implementing a Lisp
Read LISP in Small Pieces. It'll ask most of your questions.

Discuss how the perfect module/namespace should behave.
Lambda-calculus already gravitates towards a simple "environment" argument, which holds "dynamic" state. Why would you implement some external module/namespace hack? Do you miss C++ so much?

Name: Anonymous 2011-12-24 23:53

>>1
yeah I was trying to figure out a good mechanism for multimethod names too. If you ever have to refer to one specific multimethod, maybe using the types of the arguments could uniquely address it?

Name: Anonymous 2011-12-25 0:06

>>3

Lambda-calculus already gravitates towards a simple "environment" argument, which holds "dynamic" state.

why?

Why would you implement some external module/namespace hack? Do you miss C++ so much?

when you have thousands of functions defined, you might need a way to manage them and avoid name collisions in an effective way. There's no reason that functional stuff can't scale to the same level as seeples. You should check out ocaml. objective stuff and functional actually mixes pretty well.

Name: Anonymous 2011-12-25 0:23

i like the way perl handles namespaces. (CPAN)

Name: Anonymous 2011-12-25 0:43

>>5
why?
Because lambda calculus has almost no external environment. The only external word is "lambda" and the easiest way to implement environment is to just (lambda (environment . args) ...) for every function.

when you have thousands of functions defined, you might need a way to manage them and avoid name collisions in an effective way.
Use static analysis where possible. Inline them and use something like JIT to reinline on change.

objective stuff and functional actually mixes pretty well.
first class environment is already "objective stuff"
it serves the same role as sepples objects.
you basically apply closure to environment "object" (a list of object's variables). And rememver, you can have several environments, cuz they are first-class.

Name: Anonymous 2011-12-25 0:48

>>7
Oh, and multi-inheritance is crazy complicated. Because it fucking merges several environments! Never do multi, kids. Use interfaces or something.

Name: Anonymous 2011-12-25 1:46

>>7

yeah, I guess I wasn't thinking about about the external environment. I was only thinking about managing tons of names. If namespaces are the only feature provided, then the transformation could be done at compile time. At run time, it would look like there were 1000 functions with 1000 distinct names, but when you are writing the code, you can encapsulate certain names so you don't need to worry about collisions across the project.

You were talking about how instance methods or member functions or whatever the relevant word is is aware of names of the member variables in the "this" object? As well as static fields in the this class? Yeah, I don't place too much value on this feature. I prefer explicitly passing in the this object, and referring to the member variables like this->way.It makes it more obvious what you are referring to and helps with reading.

>>8

yeah, and it would make multimethods incredibly confusing. It's bad enough with the object-contains-the-function model.

Name: Anonymous 2011-12-25 2:51

>>3
Keeping everything in the same environment?  Not a bad idea, but what if private (as in, ``not intended to be used externally'') symbols collide?  I could use some form of gensyms on those, though.  I'd like to have your thoughts on it!

Name: Anonymous 2011-12-25 3:33

>>9
then the transformation could be done at compile time.
You should pick Haskell or ML instead. Modern Lisps are more about flexibility, runtime and JIT.

Name: not shit thread 2011-12-25 5:44

Name: Anonymous 2011-12-25 17:08

What about having one environment per function, as well as providing the ability to store per-CPU or per-continuation values?

I think that could be used to implement a fairly fine module system.

Name: Anonymous 2011-12-25 19:42

>>13
per-continuation values
U MENA DYNAMIC SCOPING

Name: Anonymous 2011-12-26 0:07

Name: Anonymous 2011-12-26 1:43

Name: Anonymous 2011-12-26 3:53

Name: Anonymous 2011-12-26 14:16

Are you using sexprs?

Name: Anonymous 2011-12-26 18:19

>>18
No, something more readable. But the translation to sexpr is very simple and happens before any processing.

Name: Anonymous 2011-12-26 18:44

>>19
cool!

are
  you
  using
    notation
      postfix?

Name: Anonymous 2011-12-26 18:46

>>20

,
  silly
    me
  meant
    I
    prefix


postfix try to going you are Or?

Name: Anonymous 2011-12-26 18:49

>>20
notation postfix using ? you are

Name: Anonymous 2011-12-26 18:51

postfix try going-to or ? you are

Name: Anonymous 2011-12-26 18:54

>>22

I am now very confused. Oh well.

.
  am
    I
    now
      very
        confused
.
  Oh
    well

Name: Anonymous 2011-12-26 19:01

>>24
notation gets pushed on the stack.
postfix ( not -- postnot ) transforms a notation on the stack to postfix-notation.
using ( obj -- using<obj> ) marks the first object on the stack as being used.
? ( obj -- obj? ) marks the first object on the stack as a question.
you gets pushed on the stack.
are ( what subject -- simple-sentence ) takes the first two object on the stack, and combines them to form a simple sentence.

Name: Anonymous 2011-12-26 19:32

>>25

I see. Thanks for the explanation!

[code]
sentence_series(sentence(see(I,null)),
                exclamation(Thanks(for(the(explanation)))))
[/code[

Name: Anonymous 2011-12-26 19:49

>>20-21
Yes, it's still prefix notation, coupled with sweet-expression-like capability for infix for math stuff.  There are also a few (x . y)-like shortcuts, for things like set! for example.  But don't worry, it's still homoiconic (since I want my macros to work properly without any surprises).

Name: Anonymous 2011-12-26 20:21

>>27

cool stuff, keep us posted!

Name: Anonymous 2011-12-26 21:33

Fuck fuck fuck this is incredibly confusing.

Name: Anonymous 2011-12-27 2:29

Languages-some Latin Japanese Sumerian Turkish-and-and-and-like notation postfix-of use. However, these-all Sumerian-but words "of"-like noun-each before after-or-either-at phrase end-of rather-than place clauses relative noun modified unmarked verb follow-where have-and. Sumerian syntax-this ergativity except uses. Phrases "ig e lugal.ak.ak.ta"-like "door house king-of-of-from"-meaning-with Sumerian language stacking truly is.

Some langauges like Latin, Japanese, Sumerian, and Turkish use postfix notation. However, all of these but Sumerian place words like "of" either before or after each noun rather than at the end of the phrase and have relative clauses where an unmarked modified noun follows the verb. Except for ergativity Sumerian uses this syntax. With phrases like "ig e lugal.ak.ak.ta" meaning "from the door of the king's house" Sumerian is a truly stacking language.

http://psd.museum.upenn.edu/ppcs/ppcs-manual.pdf
WARNING: This document contains S-exps.

Name: Anonymous 2011-12-27 2:50

>>30
lol what if the inventor of forth was summerian

Name: Anonymous 2011-12-27 3:57

>>7
the easiest way to implement environment is to just (lambda (environment . args) ...) for every function.
You know, I'm actually considering something like that. Are there any downsides to doing so?

Name: Anonymous 2011-12-27 7:42

(filter posts
    (lambda (post)
        (zero?
            (mod (slot-value post 'id)
                 11))))

Name: Anonymous 2011-12-27 19:09

Name: Anonymous 2011-12-27 19:18

>>30
That paper is awesome. Now we need syntax highlighting for Sumerian parse trees.

(S (NP-ERG *)
   (NP-ABS (S-NOM (N geme)
                  (NP-ERG (PN ludumuzik)
                          (ERG e))
                  (VC-F (CN i)
                        (P1 n)
                        (V tuku))
                  (NOM a)))
   (NP-TER (N-C (N ec)
                (N kiri))
           (TER ece))
   (VC-F (MD na)
         (CN ba)
         (V du)))

Name: Anonymous 2011-12-27 19:26

http://www.luafaq.org/#T8.2.1

Could this be the answer?  It seems to treat the environment _ENV as any variable, which means that you can close over it or use it as an argument.

Name: Anonymous 2011-12-27 22:15

>>36

umena this?

Name: Anonymous 2011-12-27 22:51

>>37
I think you forgot to post a link.

Name: Anonymous 2011-12-27 22:53

>>38

no, Imeana this!

Name: Anonymous 2011-12-27 23:01

>>37,39
back to hugbox, autismus

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List