News for hackers. Stuff that matters.
Re:About V, the language Volt is written in by nicoburns on Wednesday February 06, 2019 @09:43PM (#19102484)
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.

Re:About V, the language Volt is written in by amedvednikov on Wednesday February 06, 2019 @09:53PM (#19102564)
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.
Re:About V, the language Volt is written in by User23 on Thursday February 07, 2019 @12:41AM (#19103285)
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.
Re:About V, the language Volt is written in by iainmerrick on Thursday February 07, 2019 @03:37AM (#19103887)
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.

Re:About V, the language Volt is written in by heinrich5991 on Thursday February 07, 2019 @03:51AM (#19103935)
https://github.com/thepowersgang/mrustc is an alternative compiler for Rust.
Re:About V, the language Volt is written in by coldtea on Thursday February 07, 2019 @04:48AM (#19104136)
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.

Re:About V, the language Volt is written in by nicoburns on Thursday February 07, 2019 @05:46AM (#19104328)
JavaScript isn't quite as new as those listed, but it has at least 5 or 6 implementations.
Re:About V, the language Volt is written in by coldtea on Thursday February 07, 2019 @05:53AM (#19104354)
Yeah, JS too.
Re:About V, the language Volt is written in by sacado2 on Friday February 08, 2019 @08:55AM (#19114086)
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".

Re:About V, the language Volt is written in by iainmerrick on Thursday February 07, 2019 @03:54AM (#19103947)
Cool! Looks like that’s not quite ready for prime time, but I hope it succeeds.
Re:About V, the language Volt is written in by skocznymroczny on Thursday February 07, 2019 @09:23AM (#19105356)
While older than 10 years, it still kind of falls under newish, but D has three compilers.
Re:About V, the language Volt is written in by kupiakos on Thursday February 07, 2019 @03:50AM (#19103931)
Python has PyPy?
Re:About V, the language Volt is written in by iainmerrick on Thursday February 07, 2019 @03:53AM (#19103943)
Python isn’t new! It’s almost 30 years old.
Re:About V, the language Volt is written in by kupiakos on Thursday February 07, 2019 @04:06AM (#19103986)
I was about to suggest Python 3, but it seems Python 3.0 released December 3, 2008. Barely missed it!
Re:About V, the language Volt is written in by amedvednikov on Thursday February 07, 2019 @12:48AM (#19103320)
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.

Re:About V, the language Volt is written in by User23 on Thursday February 07, 2019 @02:14AM (#19103607)
I’m very happy to see that you’re doing this. Keep at it!
Re:About V, the language Volt is written in by rafaelvasco on Wednesday February 06, 2019 @10:03PM (#19102629)
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.
Re:About V, the language Volt is written in by amedvednikov on Wednesday February 06, 2019 @10:07PM (#19102650)
I'm planning to optimize this so that no copies are created.
Re:About V, the language Volt is written in by rafaelvasco on Wednesday February 06, 2019 @10:10PM (#19102676)
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.
Re:About V, the language Volt is written in by runeks on Thursday February 07, 2019 @10:04AM (#19105589)
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.