Hacker Newsnew | past | comments | ask | show | jobs | submit | p2edwards's commentslogin

Hey cool! I've been wanting something like this for a while.

Would it be able to take multiple inputs?


There's plans for a future iteration to be able to (I want to decouple multiple keyboard inputs!).

However in the git repo and prototype, ATM it's 1 input 1 output.


H*R is up again.

https://homestarrunner.com/main

Using Ruffle. Like the others, it's somewhat recent.

https://en.wikipedia.org/wiki/Homestar_Runner#cite_ref-18


Agreed —

seeinglogic's article made me think of a 3rd option:

1. Sorta long functional chain where the type changes partway through 2. Use temp variables 3. (New option) Use comments

(Here's funcA from seeinglogic's article, but I added 3 comments)

    function funcC(graph) {
      return 
        // target node
        graph.nodes(`node[name = ${name}]`)
          // neighbor nodes
          .connected()
          .nodes()
          // visible names
          .not('.hidden')
          .data('name');
     }


Compare to funcB which uses temp variables:

    function funcB(graph) {
      const targetNode = graph.nodes(`node[name = ${name}]`)
      const neighborNodes = targetNode.connected().nodes();
      const visibleNames = neighborNodes.not('.hidden').data('name')

      return visibleNames;
    }
For me the commented version is easier to read and audit and it also feels safer for some reason, but I'm not how subjective that is.


Funny, I see the need to add comments as an indicator that it's time to introduce chunking of some sort--arguably it already has been.

In this case, I'd lean towards intermediate variables, but sometimes I'll use functions or methods to group things.

I prefer function/method/variable names over comments because the are actual first class parts of the code. In my experience, people are a bit more likely to update them when they stop being true. YMMV.


I do miss 2 features from LiveScript:

1. `wxyz = [ 2 8 -5 5 ]` (commas optional for non callables)

2. `console.log \hello` (backslash strings)

Don't know how hard/compatible #1 is, but for #2 I had a tested PR that I could bring around.

(#3 was bulleted lists, but you already added that!)


This is awesome. Thanks for making it.


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: