On Fri, Mar 14, 2025 at 08:15:51AM +0000, 'Sainan' via lua-l wrote:
> Not to mention that even a 0-based language like JavaScript could have this semantic in an array like [-100, 0, 100, 200, ...].
indeed. when it comes to "langages for non-programmers", I would really
use langages like raku to write a DSL that could be as natural as
possible so the capacity to define postfixed operator is important to
write thinks like
17th.middle.year == 1650
Trafalgar + 1week
Ruby use monkey patching to do this which is a bit ugly and dangerous
but raku, for exemple has operator definition:
class Century {
has Date $.begin;
has Date $.middle;
has Date $.end;
}
sub postfix:<th> (Int \d) returns Century {
my \begin = (d - 1) * 100;
Century.new:
end => (Date.new: year => begin + 99),
middle => (Date.new: year => begin + 50),
begin => (Date.new: year => begin)
}
regards
--
Marc Chantreux
Pôle CESAR (Calcul et services avancés à la recherche)
Université de Strasbourg
14 rue René Descartes,
BP 80010, 67084 STRASBOURG CEDEX
03.68.85.60.79