FascinatedBox / lily

Interpreted language focused on expressiveness and type safety.

Home Page:http://lily-lang.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

lily_optional set of functions

FascinatedBox opened this issue · comments

Currently, a user wanting to implement optional arguments for a function needs to implement them in a manual fashion using lily_arg_count and usually a switch on args.

However, there are many cases where a user only wants a single optional argument.

I'm thinking of adding a set of functions that does a default check and takes in a fall back value.

The result would look like lily_optional_integer(s, 0, 100). The optional parameter would come after the register number. I'd want this function to handle both the simple case of plain optarg as well as the slightly more complex case of keyword optargs.

Closing this as part of the gitlab migration: https://gitlab.com/FascinatedBox/lily/issues/366