News for hackers. Stuff that matters.
Re:Show HN: Programming is Now Two-Dimensional by zimbatm on Wednesday June 21, 2017 @02:28PM (#14606574)
I would like to make a claim that ETN doesn't reduce complexity of programs, it merely splits it in two: the TN that declares the data structure and the interpreter on the other side. To fully understand a piece of code one has now to study both sides.

In a bigger program, and because this approach seems to encourage the proliferation of DLS, one has to do the same process repeatedly. It seems to be a lot of context a developer has to maintain in their head.

Re:Show HN: Programming is Now Two-Dimensional by zimbatm on Wednesday June 21, 2017 @02:38PM (#14606688)
Take the other example in the paper: https://github.com/breck7/treenotation/blob/master/paper/tre...

How does it know that line starting with a number translates into a switch case. Is it the case for all function definitions or just because it's named getLocation?

In any case some logic is hidden there and making the ~10x size reduction is dubious. It only works because there is some other code that's not show here that implements that casing logic.

Re:Show HN: Programming is Now Two-Dimensional by breck on Wednesday June 21, 2017 @03:21PM (#14607046)
Good points!

The example is arbitrary. In a real world use case, Ohayo, with a very large and complex program, my ES6 code base is reduced by a factor of 10x.

My tests, in an ETN, are super simple to run, run concurrently, and are about 400 lines of code. They are equivalent to about 4k lines of very good ES6.

The tests cover about 70% of all branches in the app (that test coverage number isn't near 100% because lots of files are still experimental and I haven't segmented those out yet in Istanbul). Being able to write great test coverage concisely has been one of my favorite uses for ETNs so far.

Re:Show HN: Programming is Now Two-Dimensional by zimbatm on Wednesday June 21, 2017 @06:58PM (#14608701)
Nice. Pardon for the skepticism but I have seen a number of languages making similar claims. Lisp and SmallTalk where some of the earlier ones.

I guess a lot comes down to tooling, will Ohayo be able to understand the various DSLs to extract meaningful context or is it more like a tree editor?

Re:Show HN: Programming is Now Two-Dimensional by breck on Wednesday June 21, 2017 @03:15PM (#14607007)
Thank you zimbatm! These are great comments.

Your point is a great one. I could write a program in bash with 2 words that might take dozens of nodes in Python:

  wget https://news.ycombinator.com/
But in reality what's happening is just the complexity is shifted from the user to the interpreter creator.

LISP programmers are used to this. ETNs are very much like Lisp, except it removes the AST parse step (and the parentheses!), leaving the resulting programs simpler than their Lisp equivalents.

Re:Show HN: Programming is Now Two-Dimensional by kazinator on Wednesday June 21, 2017 @07:18PM (#14608852)
> ETNs are very much like Lisp, except it removes the AST parse step (and the parentheses!), leaving the resulting programs simpler than their Lisp equivalents

I don't see how this is different from:

Sweet Expressions:

- https://www.dwheeler.com/readable/

Wisp:

- http://dustycloud.org/blog/wisp-lisp-alternative/

and some others.

Re:Show HN: Programming is Now Two-Dimensional by kazinator on Wednesday June 21, 2017 @09:39PM (#14609520)
Re:Show HN: Programming is Now Two-Dimensional by zimbatm on Wednesday June 21, 2017 @02:32PM (#14606625)
Take the JSON encoding example. How does it know that 802 is a number? What if I want to have "802" as a string? Is it because visitors.mozilla has a fixed schema that it's value is an int or does it try to parse the string as an int first and then bails off back to a string if it doesn't work?
Re:Show HN: Programming is Now Two-Dimensional by drostie on Wednesday June 21, 2017 @02:43PM (#14606747)
It's the latter. The JSON encoding example is actually a really bad example for this language because there is a huge class of JSON which it cannot easily be seen to encode, though you can probably make some exceptions. An example of the many undefined things would be:

    {"abc def": ["123 456", 789, 101112, null, false]}
A better DSL for JSON would have to include actual data types or so,

    obj
     abc def
      arr
       str 123 456
       num 789
       num 101112
       null
       bool f
...or so.
Re:Show HN: Programming is Now Two-Dimensional by breck on Wednesday June 21, 2017 @03:09PM (#14606969)
The paper takes the example from jsonETN. The first letter is the data type.

  s: StringNode
  n: NumberNode
  a: ArrayNode
  o: ObjectNode
  b: BooleanNode
  j: OtherNode
I just posted the repo here if you're curious. https://github.com/breck7/jsonetn

It used to pass every test, but I haven't touched it in a while and seems like a few lines need to be updated to bring it up to date with TN 4.0 (it's on 3.8 now). Handles the tricky JSON edge cases fine.

It would be great if someone wanted to maintain a solid JsonETN! I'm on to the Turing Complete ETNs nowadays, but a JSON ETN would be great and would let you use ETN tools to work with JSON.

Package.json for NPM should eventually switch to an ETN. Would provide noticeable benefits.

Re:Show HN: Programming is Now Two-Dimensional by breck on Wednesday June 21, 2017 @03:25PM (#14607074)
I do like the 3 letter word better than my 1 letter word. Nice job!
Re:Show HN: Programming is Now Two-Dimensional by breck on Wednesday June 21, 2017 @03:23PM (#14607062)
In the jsonETN I whipped up, the first word indicates the node type. n is number, s is string. Seemed good enough. Probably could be a better ETN for JSON if someone wants to give it a whirl. (For reference; https://github.com/breck7/jsonetn)
Re:Show HN: Programming is Now Two-Dimensional by zimbatm on Wednesday June 21, 2017 @06:56PM (#14608690)
since each line is parsed a second time, couldn't you take yaml's approach to value encoding and asking ambiguous strings to be quoted?