emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Why shouldn't we have a #if .... #else .... #endif construct in Emac


From: Emanuel Berg
Subject: Re: Why shouldn't we have a #if .... #else .... #endif construct in Emacs Lisp?
Date: Sun, 03 Sep 2023 02:18:03 +0200
User-agent: Gnus/5.13 (Gnus v5.13)

Stefan Monnier via "Emacs development discussions." wrote:

>>>> In C, we have the very useful conditional compilation
>>>> directives introduced by #if or #ifdef, etc., which end
>>>> at #end.
>>>
>>> Those are directives to the C preprocessor and some people
>>> say it is a sign of weakness such a thing is even
>>> necessary to begin with.
>>>
>>> Let's see if they are right!
>>>
>>> What problem do you have? If we can solve it in Elisp, we
>>> cannot say those people saying that are wrong.
>>
>> FWIW, Common Lisp has reader macros to solve the problem:
>> http://clhs.lisp.se/Body/24_aba.htm
>
> I don't see why reader macros would be needed here.
> Reader macros are useful to introduce funny new shorthands
> or to avoid *reading* a chunk of code (e.g. because it uses
> some unsupported funny syntax) but in the present case we
> can read both branches of the `if` just fine, we just want
> to throw away one of the two before we macro-expand it.

In general, Lisp macros seem much more powerful and versatile
than the C preprocessor, and they are part of the language as
well.

But let's say preprocessor directives are part of the
C language as well then even tho it doesn't feel like
it, really.

The question is then, is there anything you can do with the
C preprocessor which you _cannot_ do in Lisp - with or
without macros?

-- 
underground experts united
https://dataswamp.org/~incal




reply via email to

[Prev in Thread] Current Thread [Next in Thread]