in defense of smaller (in keyword) dialectsby mn (no login)
fig would be larger by now, if i hadnt gone out of my way to avoid making it larger. for one thing, it would have a "translate" command, which you can instead add to any fig program like this:
#### license: creative commons cc0 1.0 (public domain)
function translate tr frm to
=== for trs in enumerate(frm):
======= tr = tr.replace(trs, to[trs])
=== return tr
#p = tr : return p
#implemented in the fig translator, p would be passed implicitly instead of explicitly
p = "a noise annoys a noisy oyster" : ucase : translate(p, "ABEGIOS", "4836105") : print
frm = "A BE EY GE I OH S" : split(frm, " ")
to = "4 08 3.0 6 1 0 5E" : split(to, " ")
p = "a noise annoys a noisy oyster" : ucase : translate(p, frm, to) : print
#4 N0153 4NN0Y5 4 N015Y 0Y5T3R
#4 NO15EE 4NNOY5E 4 NO15EY OY5ETER
why doesnt fig have a translate command? because it (very simply) doesnt need one.
you can make a "kitchen sink" basic dialect, python is a kitchen-sink dialect too, but it does have a small language (probably too small-- fig imports some libraries just to get going) that can be extended, even with standard libs. its a good idea.
but small languages are a wonderful thing, too (fig is deliberately small, but allows inline python)
how relevant is language size to simplicity? depends who you ask...
"hey designed their language with plain English and high school algebra like commands and so that the lay user could learn a very few commands and then be able to write interesting programs."
of course you can do that with a larger language (only use a few commands) and theres always a way "cheat" (extend) to get more functionality, but even after learning several languages i still admire the ones that only make you learn 50-150.
fig has about 90. some are aliases, so it depends on how you count them: wend, next, and resume end command blocks, and all of those can use "fig" in their place-- because they basically just "unindent" the python output. (all blocks in python end by unindenting.)
"fig" is used at the end of all conditionals, which is very similar to "fi" ending an if block in bash (and a few other languages that used this if/fi do/od case/esac convention.)
Return to Index