gracelang / language

Design of the Grace language and its libraries
GNU General Public License v2.0
6 stars 1 forks source link

Does emptyList exist? #165

Closed KimBruce closed 5 years ago

KimBruce commented 6 years ago

What is the status of emptyList? It is not listed in the documentation for the standard Grace library, yet it works. In the header for list, it is suggested to write list[] to get an emptylist, though at the end of the description of the standard library it appears in the definition of a merge method.

Thus the question, should I teach my students emptyList or just have them write list[] (or does it matter)?

apblack commented 5 years ago

We decided, I think, to make list "module-like". That is, we should have list.empty, list.withAll(aCollection), list.with(item1), etc. Which does say whether a dialect should allow list, list(_), list(_,_), etc., for creating empty and short lists.

apblack commented 5 years ago

I guess that the answer to this issue is that emptyList is deprecated. It is no longer documented, but it still exists to enable a graceful migration to list.empty, rather than a lot of crashes.

kjx commented 5 years ago

Does say or doesn’t say?

Sent from my iPhone

On 2/08/2018, at 18:28, Andrew Black notifications@github.com wrote:

Which does say