[OT] Some neat ideas from the Kotlin language
Jacob Carlborg via Digitalmars-d
digitalmars-d at puremagic.com
Sun Feb 21 03:54:10 PST 2016
On 2016-02-19 13:28, Nemanja Boric wrote:
> IMHO, without language support looks really bad - `map` really sticks
> out here.
>
> What Rust is doing:
>
> ```
> let foo: Option<i32> = bar();
>
> let new_stuff = match foo {
> Some(x) => x,
> None => 0
> }
> ```
You can do the same in Scala, it has built-in pattern matching. Although
I think the map approach is preferred, but I'm not a Scala expert.
--
/Jacob Carlborg
More information about the Digitalmars-d
mailing list