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

Just a note #2

Closed
asterite opened this issue Jul 8, 2021 · 1 comment
Closed

Just a note #2

asterite opened this issue Jul 8, 2021 · 1 comment

Comments

@asterite
Copy link

asterite commented Jul 8, 2021

Hi!

I started working on crystal i (announced at today's Crystal Conference) about two months ago and after a month or so of working on it I revealed it to some of the core team members. One of them (Johannes) told me that you were working on this already, and I felt a bit bad that we were duplicating work. At that time I couldn't tell you this because I wanted to keep it a secret until today. I also didn't know if what I was doing was going to work at all. I hope you are not mad! 🙏 I think working on these things is super fun and interesting, regardless of whether they see the light some day or not. I hope with the lessons you learned with this project you can help us make crystal i complete and even better. Thank you! ❤️

@I3oris
Copy link
Owner

I3oris commented Jul 18, 2021

Hello,

Sorry for the response delay, I had very little time to work on this project lately, and I had even not seen the issue on github 😮 !

That was in effect a really great experience to work on that and I've learned a lot on crystal internal working, make me loving it more even ❤️

I'm not frustrated by the announcement of crystal i, on the contrary if find that awesome!

I would be glad to help on the crystal i project, so as a first help, and if you have not ever done, you can take a look to my code. I've succeeded to make some part of language working very well, like yield or closures!. (though I have some difficulties with dispatch, making lot of thing not working yet)

You can see what is functional in the specs, for example this some heavy random code with closures work as expected: 😄

x = 42

p1 = ->(a : Int32, b : Int32) { a + b }
p2 = ->(a : Int32, b : Int32, c : Int32) { a + p1.call(b, c) }
p3 = ->(a : Int32, b : Int32) { p2.call(b, p2.call(a, 2*a, b), a - 10) }
p4 = ->(p1_ : Proc(Int32, Int32, Int32, Int32), p2_ : Proc(Proc(Int32)), arg : Int32) do
  ->(y : Int32) do
    p3.call(p1_.call(arg + x, 5, arg - 4), p2_.call.call)*y
  end
end

p4.call(->(c : Int32, b : Int32, a : Int32) do
  p4.call(p2, ->{ p1.partial(42, c) }, 7 + c).call 31 + a + b
end, ->{ p3.partial(1, 2) }, -1).call 7
#
# => 617_918 on both `crystal` and `ic`

I've also done some improvements on highlighter from https://github.com/crystal-community/icr/blob/master/src/icr/highlighter.cr, I see that you have take and optimized the same source code too.

I've done some fix with ivars, heredoc or added coloration for named tuple or named argument:

img

I've also write a very powerful macro to map all the interpreted libC, LibCG and LibIntrinsics, to their equivalent calls in compiled crystal.

However I've really not designed IC for performance. IC dynamically walk on the ASTNode and return the result recursively, meaning that literal are reinterpreted all time, making IC really slow. I think bytecode is really the best way for a such project, good jobs to have accomplish that! 🎉

So I am totally in favor of Crystal i if this is fasted and directly included in crystal ❤️ !
I really hope my project can help to achieve that, and a could be here if you have any question on the code or other.

Finally if it interest you, I have also spend lot of time on user interface and add some nice features like auto-indent, auto-formatting or the ability to write .[some code] as an equivalent to __.[some code], in which __ is the same as _ of irb.

Here is an overview of what is look like: 😃

Hello.World.IC.mp4

That is,
I hope that we can merge our ideas to achieve the best crystal i 🚀🚀🚀!

@I3oris I3oris closed this as completed Nov 9, 2021
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