Conversation
| - The `const` keyword is used for subject which value cannot change. | ||
| ```cpp | ||
| const name = "John" | ||
| name = "Doe" // Invalid! | ||
| ``` |
There was a problem hiding this comment.
I don't agree with using const for constants because it is verbose and would be tiresome to keep typing since it is going to be used a lot code. let as a constant is not a new syntax on the block. They have been popularised by Swift and Rust. We could also use val as popularised by Kotlin and Scala, but I think let is more expressive.
In modern languages, constants tend to be used quite a lot, because there is these notion of immutability by default, therefore these languages try to keep the keyword as short as possible. Usually as three letter words. val and letbeing the notable ones.
If you do a quick grep on any repo with code written in modern languages, you will notice constants are declared way more than variables.
| ``` | ||
|
|
||
| ```rust | ||
| const name = (condition ? "John" -> "Peter" ) |
There was a problem hiding this comment.
For me, the -> operator looks a bit confusing considering the fact it uses the same operator as the return statement.
At first glance, one would expect that it follows the same style of after the -> operator, a return type follows immediately.
There was a problem hiding this comment.
I agree with @tnkemdilim on this. We should disambiguate symbols and the tokens. If it already means something before. It shouldn't mean something else.
Maka Safety....
| - A `for` loop iterates through an iterable and binds the value to a subject. | ||
|
|
||
| ```py | ||
| for i in 1:11 { |
There was a problem hiding this comment.
Is this for 1 to 10 (exclusive of 11)?
A quick suggestion, how about having a syntax for the last number included e.g. :=?
I believe having an inclusive range syntax would improve the way people would write (instead of +1 every single time).
There was a problem hiding this comment.
Also, how does on include a step size for the loop ? We can't afford to make including a step size arg to a for loop with : as cumbersome as it is currently in python 3 if you ask me.
| trait Callable { | ||
| call: (...Int) -> Int | ||
| } |
There was a problem hiding this comment.
I so much agree with the idea of adopting traits.
Although, we'll have to take into consideration certain scenarios, and establish a means for resolution. E.g.
- Multiple traits with at least 1 similar function definition,
- Can traits inherit other traits?
- etc.
| - Declaring a generic function | ||
|
|
||
| ```swift | ||
| impl Buffer:[T] where T < Integer { |
There was a problem hiding this comment.
There's quite a lot going on here. Apparently, we are enforcing that the size of T is less than an Integer.
What operators are permitted in such scenarios?
I'll advise we give this a thoughtful and close look before proceeding.
There was a problem hiding this comment.
This syntax carries a lot of implementation implications going forward. We really need to get much more grounded on what implementation will look like in time.
No description provided.