1. 22
  1.  

  2. 2

    Pretty cool!

    1. 2

      The language is cute, but some of the choices are odd. Iirc, things like log have to be imported, but make for creating directories is builtin? Also why not call in makeDir to be in accord with readFile and writeFile?

      1. 1

        What happened during development that meant instead of typing -5 for negative 5, you had to type ~5?

        1. 1

          The creator of Ink explains that in a GitHub issue.

          1. 1

            I see, thanks. There were a couple things like that I noticed, | instead of ||, & instead of &&, nothing important but just small ways of defying convention.

            1. 5

              If Ink doesn’t have bitwise operators, | and & for logical operators is more idiomatic. Even if it has bitwise operators using the doubled form for those is more logical as they’re used much less than logical operators.

              1. 1

                I agree wholeheartedly, but just don’t see the advantage in going against convention so established, entrenched perhaps, for something so trivial.

                It’s a minor thing anyway, it doesn’t detract from the language.

                1. 1

                  From a practical standpoint, I agree with you. I just feel it’s a pity that a notation that’s basically specific to C is going to carried on forever and diverge from the standard notation of mathematical logic.

                  I’m not familiar with other languages but surely Haskell doesn’t used && for logical and?

                  1. 3

                    From my experience with Haskell a few years ago, it does. (But the single | is used for a lot of syntax.)

                    1. 7

                      From my experience with Haskell a few years ago, it does.

                      Well, then all hope is lost ;) All hail our new overlords, K&&R.

                  2. 1

                    but just don’t see the advantage in going against convention so established, entrenched perhaps, for something so trivial

                    If one is not willing to upset convention, there’s little benefit in making a new language.

                    1. 1

                      I think cross-domain syntactical convention is different to language-dependent syntactical convention. My else would you use parentheses for function arguments vs square brackets or pipe characters?

          2. 1

            Why would you represent lists as hash-maps? I’m getting PHP flashbacks 😱

            1. 3

              What’s the problem?

              1. 2

                Some drawbacks of using hash maps versus actual arrays:

                • Lookups are slower, and likely not constant time (IIRC it’s usually more like O(log n))
                • They need more memory
                • Less cache-friendly
                • Iterating them is less efficient compared to an array, as memory is not in a contiguous order. In my own experiments I found that iterating a Rust hash map is about 50 times slower compared to iterating a vector
                • Insertions are slower if there are collisions
                1. 3

                  The implementation of the language can decide to use arrays if it notices that your keys are a contiguous set of integers starting from some small integer. This is what Lua does for example. So that removes all of the implementation-dependent disadvantages you are talking about.

                  On the other hand, on the interface / usage side, it does make it so if you eg. want to remove an element and shift all the others down, you need to explicitly say that you want array / list behavior vs. map behavior.

                  1. 4

                    Yeah, I remember from reading one of the Lua papers that the runtime does a bunch of clever things to optimize for tables being used as arrays. What I didn’t get was why this is better than simply having actual arrays in the language, and removing the need for the clever runtime code.