Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Simplify the label syntax #1

Open
tim-m89 opened this issue Jul 14, 2014 · 0 comments
Open

Simplify the label syntax #1

tim-m89 opened this issue Jul 14, 2014 · 0 comments

Comments

@tim-m89
Copy link
Owner

tim-m89 commented Jul 14, 2014

The labels in Salsa are handled like the following:

-- Type level label
data WriteLine_  
-- Term level label             
_WriteLine                     = undefined :: WriteLine_
-- Functions for invoking methods with '#'
_writeLine args target = invoke target _WriteLine args
_writeLine_ target = invoke target _WriteLine ()

This could ideally be simplified. Upper case labels (the most common convention in .net) can be supported on both the type level and term level by simply:

data WriteLine = WriteLine 

Lower case (allowed in .Net as far as I know) can supported on the term level easily enough using the undefined notation though not on the type level. This is probably ok to give it some arbitrary prefix since these are very uncommon by convention:

data X_foo
foo = undefined :: X_foo

As for the invoke wrappers, these could potentially be dropped if the use of '#' as in infix operator in it's current form is not continued. The problem is that we would end up having:

Console # WriteLine "hello"

which really means:

Console # (WriteLine "hello")

Since we can't bind higher than function application, and end up trying to come up with a quick solution:

Console # WriteLine $ "hello"

Though this might not be the ideal solution. Maybe a tuple should be used, but at which end is this to be? From an oop straight from .Net perspective, the object method arg syntax does have merit. On the other hand, it feels some what more natural in a functional setting to to treat the function/method as more first class, i.e.

WriteLine # (Console, "hello")

Finally, without the invoke wrappers and changing the meaning of '#' to be more than reverse application, means that we may need 2 or more operators for both static and instance invocation (though cannot confirm). Any thoughts on syntax are greatly appreciated..

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant