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

Making Functions Setable #30

Open
porky11 opened this issue Jun 16, 2016 · 1 comment
Open

Making Functions Setable #30

porky11 opened this issue Jun 16, 2016 · 1 comment

Comments

@porky11
Copy link

porky11 commented Jun 16, 2016

It would be nice to be able to define setable functions (like setf in common lisp)

You would be able to write get(array i) = value for set(array i value)
Maybe using a syntax like this:

defsetter v get(x y) set(x y v)

It should also be possible to use it in structs then like this:

defstruct Test:
  x with: (setable => true)

val v = Test(1)
x(v) = 2
println(x(v)) ;;prints 2
@CuppoJava
Copy link
Collaborator

Thanks for the feedback. We have a number of syntactic short hands that
we're considering and a setter shorthand is one of them.
-Patrick

On Thursday, June 16, 2016, Fabio Krapohl [email protected] wrote:

It would be nice to be able to define setable functions (like setf in
common lisp)

You would be able to write get(array i) = value for set(array i value)
Maybe using a syntax like this:

defsetter v get(x y) set(x y v)

It should also be possible to use it in structs then like this:

defstruct Test:
x with: (setable => true)

val v = Test(1)
x(v) = 2
println(x(v)) ;;prints 2


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
StanzaOrg/lbstanza#30, or mute the thread
https://github.com/notifications/unsubscribe/ABaXC41ZeSktzpIrocGt12AgILIfJAOJks5qMT09gaJpZM4I3UZL
.

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

No branches or pull requests

2 participants