Live data from Hacker News

TIL: Tcl-inspired command language on top of D

til-lang.github.io

1–10 of 26 posts

Re: TIL: Tcl-inspired command language on top of D

#5
post #3

TIL is opinionated, all right, but this >The number of spaces does count. Not counting indentation, it should always be one. is the silliest "opinion" I've ever seen.

Fair enough. I'm willing to know about use cases for more than one space - and I'm completely sincere. The language is just born, we have time to adjust all these details.

Re: TIL: Tcl-inspired command language on top of D

#6
post #5
post #3

TIL is opinionated, all right, but this >The number of spaces does count. Not counting indentation, it should always be one. is the silliest "opinion" I've ever seen.

Fair enough. I'm willing to know about use cases for more than one space - and I'm completely sincere. The language is just born, we have time to adjust all these details.

People expect whitespace to be either 'indifferent' or 'significant'.

Indifferent is the default: it means you only need whitespace when tokens would otherwise parse wrong, like `symbol1234` vs. `symbol 1234`. Also, you can add as much as you want, the parser doesn't care.

Significant means that whitespace is semantic, meaningful. This almost always means depth of indentation, although I've encountered other semantic whitespaces in the wild.

Sometimes lining things up just looks nicer. Here's an example of how I like to construct a literal Lua table:

    local colors = { black  =  0x000000, 
                     white  =  0xffffff,
                     red    =  0xff0000,
                     blue   =  0x0000ff,
                     green  =  0x00ff00, }
Lots of whitespace! Two spaces on either side of the longest equals, for the longest symbol, and left-alignment on the keys.

I don't like this nearly so much:

    local colors = { black = 0x000000, 
                     white = 0xffffff,
                     red = 0xff0000,
                     blue = 0x0000ff,
                     green = 0x00ff00, }
The hex values are all over the place, it makes it harder to read them and see the pattern. Consider a collection of binary flags as another example where you really want the right column to line up.

You could choose to right-align the left column, so that the equals are in the same place and the right column lines up, but why should you? Then you miss the semantic indentation. They're columns, I want to column align them.

I support no tabs, though :D we share religion on that one.

Re: TIL: Tcl-inspired command language on top of D

#7
post #5
post #3

TIL is opinionated, all right, but this >The number of spaces does count. Not counting indentation, it should always be one. is the silliest "opinion" I've ever seen.

Fair enough. I'm willing to know about use cases for more than one space - and I'm completely sincere. The language is just born, we have time to adjust all these details.

The use case is that vertical alignment of code can often makes it easier to read.

Re: TIL: Tcl-inspired command language on top of D

#8
After C and DasBetterC (safer C) have officially become the subsets of D language [1], it will be very interesting what languages will be the de-facto superset of D. With excellent support for metaprogramming and CTFE in D (amongst other features), these supersets language can be very flexible and fast at the same time.

Kudos to the TIL's author for trailblazing this idea based on TCL. It will be very beneficial and handy for scripting commands and shell like behaviors. Just wondering is this type based TCL like language similar to Little? [2] Will it eventually support compilation similar to Emacs Lisp? [3]

Personally I'd love to have superset language in D for data science. It should be also easily embeddable and support prototyping like Lua. On top of that it should have excellent support for array, ndarray and dataframe like R [4]. Since it is based on D, then it can fulfil the the requirements for both type A and B data scientists [5].

[1]https://news.ycombinator.com/item?id=27102584

[2]https://wiki.tcl-lang.org/page/Little

[3]https://arxiv.org/abs/2004.02504

[4]http://adv-r.had.co.nz/Data-structures.html

[5]https://www.quora.com/What-is-data-science/answer/Michael-Ho...

Re: TIL: Tcl-inspired command language on top of D

#9
post #5
post #3

TIL is opinionated, all right, but this >The number of spaces does count. Not counting indentation, it should always be one. is the silliest "opinion" I've ever seen.

Fair enough. I'm willing to know about use cases for more than one space - and I'm completely sincere. The language is just born, we have time to adjust all these details.

It's the mark of a rigid parser that should not impose such limitations.

Re: TIL: Tcl-inspired command language on top of D

#10
post #6
post #5

Earlier quoted context omitted.

Fair enough. I'm willing to know about use cases for more than one space - and I'm completely sincere. The language is just born, we have time to adjust all these details.

People expect whitespace to be either 'indifferent' or 'significant'. Indifferent is the default: it means you only need whitespace when tokens would otherwise parse wrong, like `symbol1234` vs. `symbol 1234`. Also, you can add as much as you want, the parser doesn't care. Significant means that whitespace is semantic, meaningful. This almost always means depth of indentation, although I've encountered other semantic…

Wow... you picked up just the right example. I mean, hex values are just a perfect scenario - was that simple integer values I probably would disagree (I don't like the possibility of messing with diffs in the case some variable receives a big name, for instance).

Now I'm thinking about math, also. The assignment with "=" is not a thing on Tcl-like languages in general, but maybe some "formulas" would benefit from more spacing, like

  set x    1 +    2 +    3
  set y 1000 + 2000 + 3000
(or something like that. YMMV)

Okay. I'm changing that as soon as I can. Thank you very much.

Post reply on HN