emacs-devel
[Top][All Lists]
Advanced

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

Re: Emacs contributions, C and Lisp


From: Óscar Fuentes
Subject: Re: Emacs contributions, C and Lisp
Date: Thu, 08 Jan 2015 04:38:56 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux)

Richard Stallman <address@hidden> writes:

[snip]

> Eli tried to explain
>
>   > In an object-oriented language that supports operator overloading, the
>   > + or - can do anything, and accept only specific data types under
>   > certain constraints.  For example, if foo.x is of a certain data type,
>   > the candidates for the right-hand operand might be restricted to a
>   > small subset of what a + or a - can generally support.  If you
>   > complete to a large list of candidates here disregarding the
>   > constraints, you'd leave a lot of users unhappy.
>
> but he didn't give the substance, so I still don't follow.
>
> I have never used C++.

Possibly this explanation is more familiar to you: C++ has type
deduction for declarations:

auto some_var = foo(bar);

and when the compiler resolves `foo' it can choose an overload depending
on complex attributes of `bar' (such as if `bar' is an instance of a
class that implements certain method.) As each overload can return a
different type, only a C++ compiler can know which type `some_var'
finally is.

This way C++ is a bit like Lisp. In fact, the latest C++ standard
requires the existence of a compile-time interpreter that covers a fair
subset of the C++ language. The same way that it is useful to inspect
Lisp from an IDE, a C++ IDE can benefit a lot from doing that. Actually,
it can benefit more than Lisp, because the presence of types (explicit
or implicit) provides rich information that allows fine-grained features
such as batch code transformations and real-time code analysis.

[snip]




reply via email to

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