News for hackers. Stuff that matters.
Re:Bosque Programming Language by coldtea on Wednesday April 17, 2019 @06:42AM (#19681345)
>I do not see the benefit of a 'sign' function with an optional argument

Perhaps you don't see the benefit of an identity function either ("why not just use the variable")?

Encapsulating things in a function instead of a statement is key to certain patterns (and functional style).

Re:Bosque Programming Language by hibbelig on Wednesday April 17, 2019 @07:54AM (#19681710)
I agree with GP. The 'sign' function with a mandatory argument I understand. Making the argument optional I don't understand.
Re:Bosque Programming Language by CREwert on Wednesday April 17, 2019 @08:56AM (#19682098)
I think its less about a sign function than about showing how optional (i.e. nullable) values work. Most languages have them, and making that possibility explicit is recent best practice.
Re:Bosque Programming Language by Someone on Wednesday April 17, 2019 @12:21PM (#19683935)
As fjfaase said “The first is that you should try to include realistic examples in your documentation and promote good coding styles.”

That ‘sign’ example could be somewhat improved by having it return an optional int instead (returning null on null inputs), or by having it take a double and return an optional int (returning null for not-a-numbers), but I think it isn’t that hard to come up with a more realistic short example.