-
Notifications
You must be signed in to change notification settings - Fork 100
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
defproperty
#123
Comments
Allow property abstraction. fixes #123
Allow property abstraction. fixes #123
Original commits: * Generalize prenex normalization. - Previously only applicable to bool, now applicable to any ground type or object. * Allow property abstraction. * Allow properties to be imported. * Warn when property names are shadowed. * Update test for prenex normalization. fixes #123
@slpopejoy I want to write out the design we discussed over the phone to make sure we all agree on how it should look concretely. We introduce a (module accounts 'accounts-admin-keyset
"accounts module"
(model
; TODO: abstract over table / column
(defproperty conserves-mass
(= (column-delta 'accounts 'balance) 0.0))
(defproperty correct-auth
(when
(not (authorized-by 'accounts-admin-keyset))
abort))
)
...) What's the syntax for function level properties? This doesn't read right: (defun transfer (src:string dest:string amount:decimal)
"transfer AMOUNT from SRC to DEST"
(model (property conserves-mass))
(debit src amount)
(credit dest amount)) Should it look like this? (defun transfer (src:string dest:string amount:decimal)
(meta
"transfer AMOUNT from SRC to DEST"
(model (property conserves-mass)))
(debit src amount)
(credit dest amount)) Additionally you can import properties only via |
We should add the ability to abstract over properties. Two motivating examples:
Notes:
column-delta
works over either decimal or integer columns,0.0
is a decimal (and0
is only an integer). We don't currently have any language feature which would allow us to specify a0
that could be either.defconst
) and functions (defun
). Do we want the equivalent for properties? My first example is a constant whereas the second is a function.use
, like defined functions and constants.The text was updated successfully, but these errors were encountered: