0kenx

Results 26 comments of 0kenx

Or [rustdoc](https://doc.rust-lang.org/rustdoc/what-is-rustdoc.html)

I tried to solve it with a library: ``` extends inline fun unwrap_or(self: Int?, default: Int): Int { if (self == null) { return default; } return self!!; } ```...

This works though: ``` inline fun unwrap_or(opt: Int?, default: Int): Int { if (opt == null) { return default; } return opt!!; } b = b + unwrap_or(a, 3); ```...

I have a slightly awkward solution: ``` extends inline fun or_unwrap(self: Int, opt: Int?): Int { if (opt == null) { return self; } return opt!!; } b = b...

Nevermind, I got it to work

Reopened as this is indeed impossible

What's the reason for that? It feels like completely natural semantics.

Of course I can preprocess. But I also want the language itself to have good properties. The compiler should just replace const string with its content first.

For example ``` "abc".asSlice().loadUint(8); ``` gives error: Func compilation error: error: lvalue expected before `~__tact_load_uint` where as ``` let s: Slice = "abc".asSlice(); s.loadUint(8) ``` compiles without errors.