5 ms·
TIL: Tcl-inspired command language on top of D
- spkm 5y agoNow make a TIL/Tk and I'm sold!
- cleberz 5y agoYeah, that's on the plans. I want to migrate my own projects.
- tangus 5y agoTIL 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.
- cleberz 5y agoFair 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.
- samatman 5y agoPeople 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.
- cleberz 5y agoWow... 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.
- wheresmycraisin 5y agoThe use case is that vertical alignment of code can often makes it easier to read.
- kevin_thibedeau 5y agoIt's the mark of a rigid parser that should not impose such limitations.
- teleforce 5y agoAfter 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 https://news.ycombinator.com/item?id=27102584 [2]https://wiki.tcl-lang.org/page/Little https://wiki.tcl-lang.org/page/Little [3]https://arxiv.org/abs/2004.02504 https://arxiv.org/abs/2004.02504 [4]http://adv-r.had.co.nz/Data-structures.html http://adv-r.had.co.nz/Data-structures.html [5]https://www.quora.com/What-is-data-science/answer/Michael-Hochster https://www.quora.com/What-is-data-science/answer/Michael-Ho...
- mhh__ 5y agoThe De facto super set of D code will always be D. DasBetterC is mainly a thing to use if you really need it, and the ImportC work is supposed to import C. If you want to see data science done in D take a look at the Mir libraries for example. Symmetry Investments have their own DSL which has a bunch of stuff in it for data wrangling. It's closed source (I have no insider knowledge here so potentially for good), but uses lots of things D makes extremely easy (like talking to other languages) to pull in data from all over the place - like compiling C++ using Cling called from D. D is lacking libraries but makes writing them much more tractable than other languages, this is a shame.
- cleberz 5y ago> The De facto super set of D code will always be D. Well, I'd like to make it clear that creating a "de facto super set of D" is not my objective, anyway. But I'd like to say that, although compiled languages are nice and D is really amazing, I don't even dream of using D to create some quick-and-dirty scripts, the same way I don't even dream of using Til to create shell scripts (I never met any general-purpose language that served as a nice shell, Tcl being the closest one, but still - it's not a traditional shell and the experience is only tolerable, IMHO). Furthermore, it's also not my objective with Til, but I believe, anyway, that a nice scripting language on top of D would prove very beneficial to the language - it's interesting to try it, right? At least to see what happens...
- commenter12345 5y agoThis looks awesome. Thank you
- cleberz 5y agoThank you. It's on a very early stage, but I'm happy with how things are going.
- flopp 5y agoI wonder if the distinction of SubLists and SimpleLists makes static code analysis and syntax highlighting more viable than in Tcl where you cant distinguish between "code" and "data"...
- cleberz 5y agoThat's one benefit, for sure. The main reason for this was to allow each class to have its own specific behavior (specially when evaluating), pushing some work into the parser instead of the runtime, since a SubList is a list of lists while a SimpleList is always a plain list itself, so no need for ".plain" methods in the last one. This makes things faster and the cognitive load is not affected so much (on the contrary, probably: I feel the syntax seems more familiar in the end).