News for hackers. Stuff that matters.
Re:Scopes – Retargetable programming language and infrastruc... by giornogiovanna on Monday May 06, 2019 @01:17AM (#19837041)
The introduction mentions "view propagation", which does borrow checking without annotations. Is this documented anywhere?

Also, I wish more languages had homepages like the Go one[0]. It takes a lot of reading to get to the point where you can see some non-trivial code[1], which is frustrating.

[0]: https://golang.org

[1]: https://scopes.readthedocs.io/en/latest/tutorial.html#a-mild...

Re:Scopes – Retargetable programming language and infrastruc... by jonathanstrange on Monday May 06, 2019 @05:09AM (#19837867)
I was thinking the same, the pages need redesign. The best way to make people try out a language is to give an example on the first page (without scrolling). It should be more than "hello world", e.g. 99 bottles of beer or Fibonacci numbers, anything that shows me how the language looks & "feels".

That being said, this looks like a really interesting and promising language. If the borrow-checker is unobtrusive and doesn't require ridiculous boilerplate, then you can count me in! Good work!

Re:Scopes – Retargetable programming language and infrastruc... by Rusky on Monday May 06, 2019 @02:50AM (#19837328)
There's no technical reason the Rust borrow checker couldn't run without annotations either- that's a design choice, similar to the way Rust requires function types even though it could infer them. It makes inter-function contracts clearer, which improves error messages, and avoid the need for whole-program analysis.

I couldn't find anything more about "view propagation" either but I strongly suspect it's no more powerful. Probably less and/or buggier at this point, given its relative maturity.

Re:Scopes – Retargetable programming language and infrastruc... by giornogiovanna on Monday May 06, 2019 @03:36AM (#19837505)
But how would you distinguish between

struct A<'a, 'b>(&'a u8, &'b u8);

and

struct B<'a>(&'a u8, &'a u8);

without lifetime annotations?

Re:Scopes – Retargetable programming language and infrastruc... by sanxiyn on Monday May 06, 2019 @08:03AM (#19838590)
You can always assume the former(all lifetimes are different). It is strictly more general.
Re:Scopes – Retargetable programming language and infrastruc... by giornogiovanna on Monday May 06, 2019 @11:33AM (#19840333)
Thanks, so lifetimes can definitely be inferred for safe code (although just like type inference, they can lead to leaky abstractions). But aren't lifetime annotations necessary for unsafe code? How could you cast a pointer into a struct into a raw pointer and back, while preserving the lifetime, without them?
Re:Scopes – Retargetable programming language and infrastruc... by nudq on Monday May 06, 2019 @06:37AM (#19838195)
We'd start by making sure these lifetimes need distinguishing, i.e. that they aren't actually equivalent.