Merge: core: add `Sequence::get_or_default` and `get_or_null`
authorJean Privat <jean@pryen.org>
Fri, 12 Jan 2018 13:34:38 +0000 (08:34 -0500)
committerJean Privat <jean@pryen.org>
Fri, 12 Jan 2018 13:34:38 +0000 (08:34 -0500)
commitd8014c2364b88522c0e53fea60abade9add9b017
tree2c80cbd2be1ac50c83522a1f0411d7f03cf87fa1
parent83d1e26ae31f740389263f815eff4a964fbd50bb
parentd8a1608160263ecc43f5623e9cefe860a499042d
Merge: core: add `Sequence::get_or_default` and `get_or_null`

I though these existed. They do but only for `Map`s.

I just wanted to get an optional commande line argument without having to do an if.

~~~nit
# get the 2th command line argument, or else get null
var arg2 = args.get_nor_null(1)
~~~

I'm not fan of the names, but at least they are. If someone have better. Initially, I named it `try`, like `var arg2 = args.try(1)`.

Pull-Request: #2594