-
Notifications
You must be signed in to change notification settings - Fork 1
Open
Description
The current standing of simple lang is that string and array variables cannot be destructured. This seeks to provide a basis for syntax to destructure string and array variables into other arrays or string variable(s) while transforming them to other data types like integer . The dollar sign in there stands as a placeholder variable for a matched type variable to be transformed.
NEW KEYWORDS:
- match
- oftype
Synergixe hopes to sponsor an RFC that changes this slightly and adds the concept of Dsetructuring with Inline transformation of data types as they are destrcutured (derived from JavaScript programming language) into the simple language.
Code Examples
block access(params...)
@params
return params
garth... ~ match { oftype "integer" => ($ * 3) } ?= access(1, 2, 3) // garth is new array variable created
day, month, year ?= "14-09-2019" // day, month , year - new variables created
day, month, year ~ match { oftype "string" => ( toDecimalInt($) ) } ?= "14-09-2019"
We believe this proposition will reduce boilerplate code
What do you think ?
Thecarisma
Metadata
Metadata
Assignees
Labels
No labels