-
Notifications
You must be signed in to change notification settings - Fork 98
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
Array primitives #62
Array primitives #62
Conversation
@paulyoung here is something for you to play with. |
@@ -34,6 +34,16 @@ class revrange(x : Nat, y : Nat) { | |||
|
|||
func printInt (x : Int) { ((prim "printInt") : Int -> ()) x }; | |||
func print (x : Text) { ((prim "print") : Text -> ()) x }; | |||
|
|||
/* This would be nicer as a objects, but lets do them as functions | |||
until the compiler has a concept of “static objects” */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've been wondering about this 😃
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some context: I've run into naming collisions quite a bit, and while I can fix that myself right now I imagine at some point people will want to depend on ActorScript code that they didn't write and there's no way to qualify names that conflict.
I think this is working as expected. Am I correct in saying that a simple way to think of these 2 functions is:
|
Precisely! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good from my perspective but I haven't reviewed the OCaml code at all.
src/prelude.ml
Outdated
| [len; g] -> | ||
let len_nat = Int.to_int (as_nat len) in | ||
let (_, g') = Value.as_func g in | ||
let rec go prefix k i = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: some indentation seems to be off here
(I should auto-configure vim to have the right settings also for Ocaml)
## Changelog for ic-hs: Branch: master Commits: [dfinity/ic-hs@07cad526...9d250a8d](dfinity/ic-hs@07cad52...9d250a8) * [`9d250a8d`](dfinity/ic-hs@9d250a8) Simplify ([dfinity/ic-hs#62](http://r.duckduckgo.com/l/?uddg=https://github.com/dfinity/ic-hs/issues/62))
## Changelog for ic-hs: Branch: master Commits: [dfinity/ic-hs@07cad526...9d250a8d](dfinity/ic-hs@07cad52...9d250a8) * [`9d250a8d`](dfinity/ic-hs@9d250a8) Simplify ([dfinity/ic-hs#62](http://r.duckduckgo.com/l/?uddg=https://github.com/dfinity/ic-hs/issues/62))
As requested in #57.