Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I think Rust and Swift's approach of approach of making the user explicitly annotate (both at function definition time and a call time) these kind of parameters works pretty well.

I think you're right that it can often be an antipattern. But there are also use cases (usually for performance reasons), and the real problem occurs when you are not expecting the modification to happen. If the parameter is annotated then it's obvious that it might be mutated, and less of an issue...

P.S. Looking forward to the open source release. This langiage looks pretty nice/interesting to me, but there's no way I would invest time into learning a closed source lanaguage.



I don't think it's possible to have a closed source language in 2019 :) It will be released with an open source this year.


Technically (and we are technical folks) it's a language with a closed source reference implementation. A serious language designer is going to specify his language, so that other implementations, closed or open source, are possible if not available. C is the ur-example, there are dozens of implementations, some proprietary and some free.


We aren’t in a phase where languages have multiple implementations right now.

I can’t think of any well-known newish language (created in the last 10 years, say) with multiple implementations. Rust, Kotlin, Swift, Julia, Dart... any others?

Go might be a counterexample with its cgo implementation, but that was built by the same team and I have the impression (maybe mistaken) that it’s fallen by the wayside.

I don’t know if this indicates a really new language development style, with less emphasis on specification, or if it’s just a cyclic thing and some of these new languages will gain more implementations as they get more established.


https://github.com/thepowersgang/mrustc is an alternative compiler for Rust.


Yeah, but no language of the ones the parent mentioned has a non-toy, non-personal-project alternative compiler.

Perhaps only Golang (go and go-gcc).

For all others, everybody uses the standard compiler. Even in Python, PyPy is not even 10% of the users.

Whereas in C/C++ and other such older languages there are several implementation (MS, GCC, LLVM, Borland, Intel) with strong uptake and strong communities/companies behind them.


JavaScript isn't quite as new as those listed, but it has at least 5 or 6 implementations.


Yeah, JS too.


Yes, go has a formal specification, which not only opens the possibility for alternative implementations, but, more importantly, allows for the development of tools like linters.

It's way harder to develop tooling for a language which is only defined as "what its compiler can compile".


Cool! Looks like that’s not quite ready for prime time, but I hope it succeeds.


While older than 10 years, it still kind of falls under newish, but D has three compilers.


Python has PyPy?


Python isn’t new! It’s almost 30 years old.


I was about to suggest Python 3, but it seems Python 3.0 released December 3, 2008. Barely missed it!


There's no reference implementation yet.

I had a small page about the language up. I don't have some of the most basic things implemented and figured out yet.


I’m very happy to see that you’re doing this. Keep at it!


This. Letting the user annotate it is better then enforcing a behavior that is adequate in some scenarios but awkward in others. For gamedev for example, generating copies at game loop is only acceptable for small objects like Vectors and if they're allocated in the stack for example. Even if the compiler optimizes it, it is better to express the intent clearly in the code.


I'm planning to optimize this so that no copies are created.


Yeah , but i meant that a = multiply_by_2(a) still looks like it is copying things even if it isn't. Let it be immutable by default and mutable with a keyword.


For what it’s worth, if you can optimize away the immutability (copying), I’d much prefer expressing myself this way, rather than using mutability.




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

Search: