Live data from Hacker News

Lil: A Scripting Language

beyondloom.com

21–29 of 29 posts

Re: Lil: A Scripting Language

#22
post #20

Earlier quoted context omitted.

Having written an sql parser, I very very strongly agree.

I'm curious to know which part of the parsing becomes easier with Select moved later in the statements? Typical argument for the "From table select column" are due to better matching evaluation logic and improving type-ahead suggestions in IDE's, but I haven't yet heard the argument that it also makes parsing simpler.

Good question, my answer was misleading. It changes virtually nothing in the parse or in the resulting AST.

Writing the parser as a process has made me (even) more familiar with SQL syntax and semantics and understand it better, which has only increased my disgust[1] of the whole matted thorny snarl that it is. I was asking for a dose of rationality for Lil, not a syntactic infection inherited from a misdesigned language. HTH.

(BTW the designers of SQL knew well that it had other problems and admitted them, eg. search for "A Critique of ANSI SQL Isolation Levels").

[1] yeah, that's the right word.

Re: Lil: A Scripting Language

#23
I've had the pleasure of alpha-testing several builds of lil and decker. It's nice to see that it's out in the wild now.

Some of the little applications I made in an hour or two each (with live help from the creator of Lil):

- a plotting program that tweens between two different plots when you move a slider

- a frame based traditional animation program

- a (color!) paint program with reflections for drawing little mandalas

It's actually quite a nice tool for rapidly prototyping all kinds of applications.

Also, I'm not sure if it's obvious from the given link, but there are implementations of both lil and decker in both C and JavaScript, so it's an incredibly portable little system!

Re: Lil: A Scripting Language

#25
post #16

Earlier quoted context omitted.

Definitely. I would argue even in shell scripts it's not always great. Just thinking about all those times rm -rf "~/${configdir}" accidentally wiped someone's home directory because that unset variable was implicitly turned into an empty string, etc. I would not want to use a language with a spongy type system for any code I'm distributing to other people But for quick one-off scripts that only I will use, it is qui…

test ! "${configdir}"||rm -rf "~/${configdir}" [ "${configdir}" ]&&rm -rf "~/${configdir}" test x"${configdir}" = x""||rm -rf "~/${configdir}" [ x"${configdir}" != x"" ]&&rm -rf "~/${configdir}" This assumes NetBSD ash or Debian ash which is what I use. I write scripts for me, not for others and often end up using "quick one-off" scripts for years. After decades of using UNIX, I have never wiped a root directory acci…

Also

  test "${#configdir}" -lt 1||rm -rf "~/${configdir}"

  [ "${#configdir}" -gt 0 ]&&rm -rf "~/${configdir}"

Re: Lil: A Scripting Language

#26

Earlier quoted context omitted.

test ! "${configdir}"||rm -rf "~/${configdir}" [ "${configdir}" ]&&rm -rf "~/${configdir}" test x"${configdir}" = x""||rm -rf "~/${configdir}" [ x"${configdir}" != x"" ]&&rm -rf "~/${configdir}" This assumes NetBSD ash or Debian ash which is what I use. I write scripts for me, not for others and often end up using "quick one-off" scripts for years. After decades of using UNIX, I have never wiped a root directory acci…

Sure, and in Zsh you can do `(( $+configdir ))` if you want to differentiate "unset" from "empty". But the fact that you need this check at all demonstrates the existence of a problem. You can also set the "-u" option (in Zsh, `setopt no_unset`) which at least will cause your script to crash with an error if you happen to forget this check. But then you have to remember to set that option as well! Lua has a similar-i…

While what you say about Lua is true, undefined variables can be promoted to errors. An `__index` function can throw an error if a slot looked up on a table is nil, and the environment is just a table.

That's Lua for you. The semantic model is dead simple and easy to understand, and even though roughly no one wants typos to become variables, the semantics would have to be less minimal to accomplish this.

So instead, there's a mechanism, a more than adequate one, but one does have to use it.

Re: Lil: A Scripting Language

#27
post #8

Earlier quoted context omitted.

This is a very domain-specific language, not designed to be used at a nontrivial scale. I think it's a good idea in this context.

Unfortunately, the fact that a system is not designed to be used at a nontrivial scale is no guarantee that it won't be used that way. For instance, there are a lot of Excel worksheets doing things I am sure the designers of Excel never expected Excel to have to do.

What's the solution to this problem? On one extreme end you can clearly state its intended use in documentation and allow undefined behavior, and on the other end you prevent the user from using the tool in any undefined way.

I'm generally positive about restricting undefined behavior at a lower level (syntax, undefined field accesses, etc), but at a higher level (writing large scale applications, using it outside of intended domains, etc) it's not very clear how and even if you should restrict unintended usage.

The more room you have for "undefined behavior" at a higher level, the more people can explore using a tool in various ways you never thought about. This can in turn be valuable feedback on possible directions to expand your tool in.

Re: Lil: A Scripting Language

#28
post #8

Earlier quoted context omitted.

Unfortunately, the fact that a system is not designed to be used at a nontrivial scale is no guarantee that it won't be used that way. For instance, there are a lot of Excel worksheets doing things I am sure the designers of Excel never expected Excel to have to do.

What's the solution to this problem? On one extreme end you can clearly state its intended use in documentation and allow undefined behavior, and on the other end you prevent the user from using the tool in any undefined way. I'm generally positive about restricting undefined behavior at a lower level (syntax, undefined field accesses, etc), but at a higher level (writing large scale applications, using it outside of…

it's not undefined behaviour, rather it's trying to be helpful by coercing stuff where it can. Unless I'm missing something, it's perfectly defined.

Re: Lil: A Scripting Language

#29
post #6

This looks like a really interesting set of language features. I do wonder why they decided to invent their own entirely new language though, instead of building on Tcl or Lua or a Basic dialect. Or even embedding Python. I can understand not wanting to use Scheme due to S-expressions being intimidating. Did they consider them harder to learn in layers? Did they feel like some language features were lacking, or were…

On their github [0] they mention that they like making compilers, and on the about page on their site [1] they say they like tinkering with new languages. I think they just had a cool idea for a project and wanted to build a language to base it off of with features that were convenient for their goal, and a syntax they enjoyed.

[0]:https://github.com/JohnEarnest

[1]: https://beyondloom.com/about/index.html

Post reply on HN