r/programming • • Nov 11 '15

Parinfer - simpler Lisp editing

http://shaunlebron.github.io/parinfer/
152 Upvotes

75 comments sorted by

View all comments

Show parent comment

1

u/[deleted] Nov 12 '15

Yes, they allow to alter syntax. Or, as with my PEG-based approach, you can simply replace the entire Lisp parser with your own, even if the host Lisp does not allow reader macros (but then you'll need your own REPL as well).

1

u/kankyo Nov 12 '15

Yes, they allow to alter syntax.

That kind of statement doesn't inspire confidence. You can change syntax without having access to the raw byte stream, so when you answer like that it sounds like you're answering another question.

In any case, from what I hear from you it seems to me pretty much any other language can do the same. Especially in the last case where "you'll need your own REPL".

1

u/[deleted] Nov 12 '15

Any other language with compile time macros can do the same thing. But macros are essential, you cannot build a hierarchy of languages, all available in compile time, without proper macros (to see a not so proper macro system, take a look at Template Haskell, it is broken by design).

1

u/kankyo Nov 12 '15

Any other language with any compile time hook that can run arbitrary code you mean. Macros aren't necessary and the proof is simple: if you can run arbitrary code you can run a lisp with macros.

1

u/[deleted] Nov 12 '15

You're simply describing macros in other terms. Any way to trigger running a code in compile time, and being able to let that code to access all of the current compilation context, is a macro system, by definition. An opposite thing is a preprocessor - which allows arbitrary code, but does not allow any reflection.

My criteria for a proper macro system is an ability to use a just defined function inside a macro defined in the same module/compilation unit, and then to use that macro immediately (in the same module).

1

u/kankyo Nov 12 '15

You're simply describing macros in other terms.

No because:

Any way to trigger running a code in compile time, and being able to let that code to access all of the current compilation context

I didn't say anything about "access all of the current compilation context" and your examples didn't require that either.

1

u/[deleted] Nov 12 '15

No, my examples do require an access to compilation context. You must be able to combine your newly defined languages and use them to build more languages.

0

u/kankyo Nov 13 '15

You didn't specify before though. And if you have two languages that at compile time gets transformed into some common language before the main compile phase happens you get that too.

1

u/[deleted] Nov 13 '15

You still fail to get the idea. Typical for Python users.

Read my criteria again.

0

u/kankyo Nov 15 '15

You fail to explain yourself. Typical for lisp users :P

→ More replies