Live data from Hacker News

The Chaos Programming Language

chaos-lang.org

11–20 of 87 posts

Re: The Chaos Programming Language

#11
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.

I suppose you could explain it that way.

But given that it's not an object oriented language, how could any variable be mutable given your example/definition?

How could you mutate a variable in a way that this language disallows?

Re: The Chaos Programming Language

#12
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.

[deleted]

Re: The Chaos Programming Language

#13
post #5

no-branching is an interesting concept, but that’s not what “immutable” means. also, why are there 3 synonyms for every single keyword?

Thanks a lot for finding the way Chaos language handles the decision making, interesting.

There are a lot of alternative keywords, especially for type safety and function definition related keywords, with the purpose of attracting programmers from other programming languages and making them feel at home. At least that was the intention.

Re: The Chaos Programming Language

#14
post #11

Earlier quoted context omitted.

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.

I suppose you could explain it that way. But given that it's not an object oriented language, how could any variable be mutable given your example/definition? How could you mutate a variable in a way that this language disallows?

> How could you mutate a variable in a way that this language disallows?

I presume something like this:

    array a = [1, 2, 3]
    a.append(4)
Names are mutable, but the values they point to are not.

Re: The Chaos Programming Language

#15
As far as I understand after reading the docs for 5 minutes, this section is the core original idea behind the language:

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.

This looks as original and language-defining as Rust's borrow checker. I really wish authors changed their docs accordingly. Everything else is pretty standard on a conceptual level, but this still has me thinking whether it's a work of pure genius, a joke language or both.

Re: The Chaos Programming Language

#16
post #5

no-branching is an interesting concept, but that’s not what “immutable” means. also, why are there 3 synonyms for every single keyword?

Thanks a lot for finding the way Chaos language handles the decision making, interesting. There are a lot of alternative keywords, especially for type safety and function definition related keywords, with the purpose of attracting programmers from other programming languages and making them feel at home. At least that was the intention.

No language I have ever worked with allowed a codebase with intermixed keywords for defining a function. In terms of feelings, it's as alien as it can get.

Re: The Chaos Programming Language

#17

As far as I understand after reading the docs for 5 minutes, this section is the core original idea behind the language: 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. This looks as original and language-defining as Rust's borrow checker. I really wish authors changed their…

Yes, you are correct. The very intuitive approach we took on decision making is the key point of the language.

I came up with this idea of designing a language with no "if" after dealing with various untestable codebases for years. They were literally untestable because of the technical debt caused by the extensive amount of "if" usage in the function bodies, especially the guard clauses makes it 1 "if" minimum for almost every functions. So at the end I have exhausted because of the if(s) and decided to create a language that forces you to have minimum technical debt.

Re: The Chaos Programming Language

#18
Influenced by:

    TypeScript's type safety

    Python's syntax, modules and extensibility

    JavaScript's availability

    Ruby's loops and blocks

    PHP's dedication to server-side

    Haskell's immutability

    C's speed

    NumPy's matrix arithmetics

    Perl's regex engine
Ehh, they forget to add another:

Will be used for exactly zero real-life production projects.

Re: The Chaos Programming Language

#19

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.…

I mean yes it's either obviously wrong or hyperbole, I assume the second.

But I think the idea is that by forcing each branch in a case to be an separate function they are forced to be unit testable.

Re: The Chaos Programming Language

#20
Please explain how operate with collections

how do I create a new array with a new value

there is GC or Structural Sharing?

Also, there is lambdas? Force the developer to create a function for each "conditional" loop costs the habit of bad function naming.

Post reply on HN