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

Layout try 3 #7

Merged
merged 7 commits into from
Jun 8, 2024
Merged

Layout try 3 #7

merged 7 commits into from
Jun 8, 2024

Conversation

complyue
Copy link
Collaborator

@complyue complyue commented Jun 7, 2024

Based on #6, I'd like to explore OO with implicits, but so far haven't had it compiles.

A major pursue in my mind is to have a single (instead of two) object identity to facilitate customizable html page template, by providing self (likely super too) reference to all methods of a single record-of-functions.

@TimWhiting do you think this direction could be feasible?

@complyue complyue mentioned this pull request Jun 7, 2024
@TimWhiting
Copy link
Member

I like this API, I think the only thing that it lacks is the ()() syntax for getting a function value from the struct and then calling it.

There is a good reason for it - for example, in the following you are wanting to return a closure and not necessarily immediately apply it.

fun main()
  val y = 1.dox
  y()

fun dox(x: int): (() -> int)
 fn() x + 1

Since struct accessors are just desugared to a function that matches on the value and gets the appropriate field, they have the same behavior, though I think we should desugar functions fields a bit differently in Koka. For now I think we should merge this one if it looks good to you.

@complyue
Copy link
Collaborator Author

complyue commented Jun 8, 2024

nice to see this compiles and actually works! yeah, we can figure out how to polish the ()() syntax later, it's already acceptable to me by far. pls merge it.

@TimWhiting TimWhiting merged commit 2c58000 into main Jun 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants