lua-users home
lua-l archive

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


2015-08-21 16:04 GMT+02:00 Coda Highland <chighland@gmail.com>:

> But the thing is, if THAT'S what you want, Lua already has it!
>
> ymd_"2015/08/01" is, by Lua's standard parsing rules, equivalent to
> ymd_("2015/08/01").

I know. But I might not remember if it is ymd or ymd_ or YMD or YMD_
or date or date_ or whatever.  Nicest would be just 2015/08/01 but Lua
already treats that as something. <2015/08/01> is a good second.
The same delimiters apply to all user literals, and if they follow a pattern
well known to the intended user community, there is nothing extra to be
memorized.

> Therefore -1 from me to user-defined literals in Lua. The ONLY benefit
> to it is pulling strings out of core, and I don't see that as being a
> significant benefit.

I may be a little wowed by a brief exposure to Rebol. Much of it s
horribly Lispian, but the wide range of built-in literals it recognizes
and treats in an object-oriented way impressed me no end.
Date, time, URL, e-mail address etc. The following code was
typed in without peeking at the documentation, despite my
last using Rebol in January.

REBOL/View 2.7.8.4.3 6-Jan-2011
Copyright 2000-2011 REBOL Technologies.  All rights reserved.
REBOL is a trademark of REBOL Technologies. WWW.REBOL.COM
>> 21-Aug-2015 - 6-Jan-2011
== 1688

The following code was typed in after refreshing my memory from
the manual, despite my using Lua daily. (At the first attempt, there
were a few errors.)

Lua 5.3.1  Copyright (C) 1994-2015 Lua.org, PUC-Rio
> os.difftime(os.time{year=2015,month=8,day=21},
   os.time{year=2011,month=1,day=6})/60/60/24
1688.0