News for hackers. Stuff that matters.
Re:Show HN: Muon, a low-level programming language inspired ... by kovrik on Monday April 08, 2019 @12:16AM (#19602018)
In the 'Glimpse of Muon' example, how does the Map::getOrDefault() function work? Shouldn't it accept 2 args: a key and a default value (if the value associated with the given key is not found)?
Re:Show HN: Muon, a low-level programming language inspired ... by nickmqb on Monday April 08, 2019 @06:53AM (#19603966)
Sibling comment (granzymes) is correct, also see implementation here: https://github.com/nickmqb/muon/blob/d557c18d2dcd3fc15a7a7a6...

In Muon, you can always add more functions to an existing namespace, so if you wanted to have a function with that behavior you could add it.

Re:Show HN: Muon, a low-level programming language inspired ... by granzymes on Monday April 08, 2019 @03:10AM (#19602852)
If the key isn't present in a Map<K, V> it returns the default_value of the type V (which is 0 for integers).