Live data from Hacker News

The Chaos Programming Language

chaos-lang.org

41–50 of 87 posts

Re: The Chaos Programming Language

#41
post #4

> Every variable in Chaos language is immutable by default. --- > kaos> num a = 5 > kaos> a = 7 > kaos> print a > 7 Doesn't that mean a is mutable by default?

The language at an early development stage. So "How immutable should variables be?" is open to discussion. You might want to open an issue and propose this in the issues section: https://github.com/chaos-lang/chaos/issues

Reassignment is mutation. It's really not... on a spectrum of mutability. JavaScript const objects allowing mutation of internal data is vaguely on that spectrum, even though it's misleading and confusing. Literally reassigning a variable isn't even up for debate.

Re: The Chaos Programming Language

#42

From https://chaos-lang.org/docs/11_decision_making > Decision making(a.k.a. control structures) in Chaos language is only achievable on function returns for the sake of zero cyclomatic complexity. ... > At first glance, defining the control structures in this way might seem so unnecessary or inconvenient but this is the pinnacle of writing 100% testable, clean and error-free code in any programming langauge by far.…

"100%" only qualifies "testable".

Re: The Chaos Programming Language

#43
post #4

> Every variable in Chaos language is immutable by default. --- > kaos> num a = 5 > kaos> a = 7 > kaos> print a > 7 Doesn't that mean a is mutable by default?

No, it only means that you can reassign the name `a` to a different value (i.e. it is a variable, not a constant). It would be mutable if it allowed something like this: > a = 5 > a.add(1) > print a 6 Note that numbers are immutable in most languages anyway. Arrays, hashmaps, and sometimes strings are the data types that are frequently mutable.

Numbers are literally never immutable in any language that isn't designed intentionally for comedy. Variables of a number type may be mutable, but the numbers themselves never mutate. Strings are typically immutable in most languages, but that does vary some (generally surprising people who expect primitives to be immutable).

Re: The Chaos Programming Language

#44
post #4

> Every variable in Chaos language is immutable by default. --- > kaos> num a = 5 > kaos> a = 7 > kaos> print a > 7 Doesn't that mean a is mutable by default?

Maybe the REPL behaves different than the interpreter? Haskell REPLs tend to work the same way. GHCi, version 8.6.5: http://www.haskell.org/ghc/ :? for help Prelude> a = 5 Prelude> a = 7 Prelude> print a 7 But yeah, it doesn't seem like there's any support for first class functions either, so perhaps just a bit too much creative license in marketing?

I have never worked with Haskell but admire it from afar, and I'm honestly astonished that the REPL works this way. I would assume this would error at the compiler for a normal program, and that the REPL runtime would enforce the same constraints.

Re: The Chaos Programming Language

#46

Earlier quoted context omitted.

Maybe the REPL behaves different than the interpreter? Haskell REPLs tend to work the same way. GHCi, version 8.6.5: http://www.haskell.org/ghc/ :? for help Prelude> a = 5 Prelude> a = 7 Prelude> print a 7 But yeah, it doesn't seem like there's any support for first class functions either, so perhaps just a bit too much creative license in marketing?

I have never worked with Haskell but admire it from afar, and I'm honestly astonished that the REPL works this way. I would assume this would error at the compiler for a normal program, and that the REPL runtime would enforce the same constraints.

I guess an argument can be made that forcing a restart of the REPL is a pretty harsh punishment, but I would expect Haskell (of all languages) to at least require some kind of tabula rasa.

Re: The Chaos Programming Language

#47

Earlier quoted context omitted.

The language at an early development stage. So "How immutable should variables be?" is open to discussion. You might want to open an issue and propose this in the issues section: https://github.com/chaos-lang/chaos/issues

Reassignment is mutation. It's really not... on a spectrum of mutability. JavaScript const objects allowing mutation of internal data is vaguely on that spectrum, even though it's misleading and confusing. Literally reassigning a variable isn't even up for debate.

Everyone says strings in java are immutable, yet you can still re-assign to string variables. It really is up for debate.

Re: The Chaos Programming Language

#48

Earlier quoted context omitted.

Yet it says [1]: > Arrays and the elements of arrays are also immutable I guess the docs need a bit of rewording. Forcing a deep-copy on variable assignment does not mean the variable itself is immutable. [1] https://chaos-lang.org/docs/07_immutability

Ah, I did not dive that deep. Now I am curious what the impact of deep copies on performance is, and if the language employs any clever optimizations to improve performance.

I don't see how you can reliably deep copy any user defined class either.

Re: The Chaos Programming Language

#49
Did anyone else think this was a joke language at first? My initial impression was that it was an esoteric language which was tongue-in-cheek passing of its oddities as language features.

Firstly, there's the name: chaos, which evokes the opposite of what my code to look like.

Secondly, the first three "features" all come across as deliberately goofy to me. The first two promise seeming implausible things: zero cyclomatic complexity and always 100% test coverage. The justifications for these promises seem bizarre: only function returns allow decision making? (A seemingly terrible place to make decisions) One test is always sufficient to have coverage? It isn't object-oriented? (Obviously, a lot more to functional then that)

Re: The Chaos Programming Language

#50

Earlier quoted context omitted.

Yet it says [1]: > Arrays and the elements of arrays are also immutable I guess the docs need a bit of rewording. Forcing a deep-copy on variable assignment does not mean the variable itself is immutable. [1] https://chaos-lang.org/docs/07_immutability

Ah, I did not dive that deep. Now I am curious what the impact of deep copies on performance is, and if the language employs any clever optimizations to improve performance.

[deleted]
Post reply on HN