top | item 23176382

(no title)

mrkmarron | 5 years ago

Hi, project owner here, great to see this on HN and always happy to hear from folks here and on the GitHub repo.

We also have a webinar with Q&A scheduled for Thursday morning (https://note.microsoft.com/MSR-Webinar-Programming-Languages...) which may be of interest as well.

discuss

order

the_duke|5 years ago

The README is full of buzz words, and yet does not explain at all how these supposedly amazing "breakthroughs" have been achieved.

The code samples look a lot like Swift, with some C++/Rust/Scala/general ML sprinkled in, so I can't see anything special here directly.

Especially relating to the promise of being as easy as Typescript but as efficient as C++/Rust/etc.

If there are great ideas in here, I'm happy to hear about them, but they should be at least be mentioned and referenced clearly.

tomp|5 years ago

Can you explain some further things about this languages?

1. How does the GC work? It says "novel reference counting" does that mean it leaks cycles or handles them (either by also tracing or preventing them statically)?

2. Is that the only thing it does to provide a C++-like "resource efficient and predictable runtime"? After all, that's basically Swift (or Python+static types). I think the main improvement that C++ (and C# and Go) have over languages like Java is ability to avoid heap-allocated objects (i.e. stack-allocated structs).

3. it looks like, but it's not entirely clear, that the compiler checks preconditions at compile time - so e.g. I shouldn't be able to call `divide(a, b)` without proving that `b != 0` - is this the correct interpretation? How do you handle mutability and/or concurrency, if at all?

mrkmarron|5 years ago

Hi and thanks for the questions:

1. By design the language provides some novel memory invariants including, no cycles in the object graph, no old-to-new pointers, and no pointer updates. Thus, we don't need to worry about cycle collection, can greatly reduce the number of Ref-Count operations, and can (later) employ pool allocation more consistently.

2. Bosque also supports by-value types (including the future ability to do by-value unions) and, since the language is referentially transparent, the compiler can aggressively use stack allocation and copy semantics. Also, the collections are all fully determinized and use low-variance implementations to avoid "bad luck" performance anomalies.

3. The compiler does not enforce the checks. They can either be checked at runtime or checked by converting the program into a logical form that Z3 or another theorem prover can check. Values in the language are immutable and there is no concurrency (yet) but since the language is immutable concurrency is by definition data-race free.

pjmlp|5 years ago

Actually that was already a thing in Mesa/Cedar, Modula-3, Oberon language family and Eiffel.

Sadly Java has not taken this into account, nor AOT support out of the box, and now it is catching up with it.

sachinjoseph|5 years ago

The use use of '=' here scares me:

   function add2(x: Int, y: Int): Int {
       return x + y;
   }
   
   add2(2, 3)     //5
   add2(x=2, y=3) //5
   add2(y=2, 5)   //7
The language already supports '=' operator for assignment of variables in the current scope, so should you use the same operator for denoting value assignment formal parameters in a function call? This can lead to a lot of confusion between variables in the scope and formal parameter names in a function that is called from the current scope.

tomp|5 years ago

Python, one of the most popular languages, uses this syntax, so I'm guessing the vast majority of people don't find it scary (I certainly don't).

dkersten|5 years ago

This seems like a non issue to me and as tomp said, is already done in popular languages without problems. The third example (keyword arguments before positional) does seem a bit odd though, as interleaving positional and keyword arguments seems like a recipe for confusion, but using = for keyword arguments doesn’t seem like a problem to me.

garyclarke27|5 years ago

I love this feature - calling named parameters is (for me) a glaring omission from Javascript (and surprisingly Typescript), I know you can define an object argument, but not many do and that’s not very elegant.

carlmr|5 years ago

>From this perspective the natural choice for the Bosque language is to adopt a pure functional model with immutable data only.

>The Bosque language fuses functional programming with block scopes and {...} braces by allowing multiple assignments to updatable variables var

This seems like a contradiction. There should only be an if-expression if 0.1 is correct. Not a branch

Garlef|5 years ago

Judging from the code snippets, the language supports generic types (`List<T>`). Are there plans to support Higher kinded types? Smth like `typedef Ev<F extends Generic, E>=F<E>`.