[Top][All Lists]

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

Re: But then what are namespaces ? (was: A read-based grep-like for symb

From: Gregory Heytings
Subject: Re: But then what are namespaces ? (was: A read-based grep-like for symbols (el-search?) (was Do shorthands break basic tooling (tags, grep, etc)? (was Re: Shorthands have landed on master)))
Date: Sat, 02 Oct 2021 19:42:15 +0000

Stefan K:

can we really say that shorthands implements namespaces? AFAIU, namespaces means that you restrict the scope of identifiers (or symbols) so that identically named identifiers in different scopes don't conflict. But shorthands does not do that, and would therefore be better described precisely as a work-around for the lack of namespaces.

Indeed. Namespaces partition the set of identifiers in such a way that the same identifier can be bound in different places to different meanings, and that you can refer to each of the different meanings of an identifier either by using their namespace prefix(es), or by importing one of the meanings of an identifier ("using" in C++, "import" in Java).

Elisp has a single namespace, and this does not change with shorthands. So indeed, as you write, shorthands are better characterized as a workaround for the lack of namespaces. Nonetheless, they provide one of the features of namespaces, namely that you can import subsets of the possible identifiers of the single namespace and access them through a shorter name.


For me "namespaces" are about allowing the same thing to be invoked by different names, depending on context.

This is not at all what namespaces are about.  This is aliasing.

reply via email to

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