civboot / fngi

a readable language that grows from the silicon
The Unlicense
60 stars 3 forks source link

function signatures #27

Closed vitiral closed 1 year ago

vitiral commented 1 year ago

I don't like them

Today we have

fn foo stk:S, b:S -> U2 do ( ... stuff ... )

I thought I wanted something like this:

fn foo(stk:S, b:S) -> U2 do ( ... stuff ... )

But I think I prefer this

fn foo[stk:S, b:S -> U2] do ( ... stuff ... )

This also lets us create a macro like:

fnTy[stk:S, b:S -> U2]
vitiral commented 1 year ago

This lets us do

absmethod foo[stk:S, b:S -> U2] \ note no `do` or semicolon or anything
vitiral commented 1 year ago

For fnTy we are going to need to support synty functions.

These work kind of like syn functions except that they return a type.

They can be used to create generics as well.

vitiral commented 1 year ago

fixed