Somewhat related to this topic It would be nice to be able to use the Elvis convenience operator in a ctor like this:
class Example { Str val new make(|This| f) { f(this) // --> Cannot use '?:' operator on non-nullable type 'sys::Str' val = val ?: "--wotever--" } }
But it gives a compilation error as shown. Thus forcing you to write it long hand:
if (val == null) val = "--wotever--"
I agree it might be nice, but that code is already fairly tricky (just fixed a bug related to it), so not sure its worth the trade-off
Login or Signup to reply.
SlimerDude Tue 10 Oct 2017
Somewhat related to this topic It would be nice to be able to use the Elvis convenience operator in a ctor like this:
But it gives a compilation error as shown. Thus forcing you to write it long hand:
brian Mon 16 Oct 2017
I agree it might be nice, but that code is already fairly tricky (just fixed a bug related to it), so not sure its worth the trade-off