I saw that their syntax is pretty similar.
Is crystal developed by the same team behind ruby?
Or is the crystal just a "compiled ruby"?
Thanks
I saw that their syntax is pretty similar.
Is crystal developed by the same team behind ruby?
Or is the crystal just a "compiled ruby"?
Thanks
I saw that their syntax is pretty similar.
Yes
Is crystal developed by the same team behind ruby?
No - inspired by Ruby.
Or is the crystal just a "compiled ruby"?
Not at all - it compiles and has a syntax similar to Ruby but is a different language. The introduction here is helpful: GitHub - crystal-lang/crystal: The Crystal Programming Language
Best Regards,
Mohit.
2022-2-6 | 1:44 pm.
On 2022-2-6 1:16 pm, Bitfox wrote:
I played around with Crystal for a little bit -- there is an analog to
Rails called "Lucky" which is really impressive.
Check out the podcast "Chicago Crystal" as well for great infos.
In the end for me, there are benefits to interpretation for debugging and
hot-reloading, which are most important to me. So I lost interest. But the
language is pretty impressive.
On Sat, Feb 5, 2022 at 9:44 PM Mohit Sindhwani <mo_mail@onghu.com> wrote:
On 2022-2-6 1:16 pm, Bitfox wrote:
> I saw that their syntax is pretty similar.
Yes> Is crystal developed by the same team behind ruby?
No - inspired by Ruby.> Or is the crystal just a "compiled ruby"?
Not at all - it compiles and has a syntax similar to Ruby but is a
different language. The introduction here is helpful:
GitHub - crystal-lang/crystal: The Crystal Programming LanguageBest Regards,
Mohit.
2022-2-6 | 1:44 pm.Unsubscribe: <mailto:ruby-talk-request@ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-talk>
--
A musician must make music, an artist must paint, a poet must write, if he
is to be ultimately at peace with himself.
- Abraham Maslow
Chicago Crystal there you go ...
On Sun, Feb 6, 2022 at 10:47 AM Sean Felipe Wolfe <ether.joe@gmail.com> wrote:
I played around with Crystal for a little bit -- there is an analog to
Rails called "Lucky" which is really impressive.Check out the podcast "Chicago Crystal" as well for great infos.
In the end for me, there are benefits to interpretation for debugging and
hot-reloading, which are most important to me. So I lost interest. But the
language is pretty impressive.On Sat, Feb 5, 2022 at 9:44 PM Mohit Sindhwani <mo_mail@onghu.com> wrote:
On 2022-2-6 1:16 pm, Bitfox wrote:
> I saw that their syntax is pretty similar.
Yes> Is crystal developed by the same team behind ruby?
No - inspired by Ruby.> Or is the crystal just a "compiled ruby"?
Not at all - it compiles and has a syntax similar to Ruby but is a
different language. The introduction here is helpful:
GitHub - crystal-lang/crystal: The Crystal Programming LanguageBest Regards,
Mohit.
2022-2-6 | 1:44 pm.Unsubscribe: <mailto:ruby-talk-request@ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-talk>--
A musician must make music, an artist must paint, a poet must write, if he
is to be ultimately at peace with himself.
- Abraham Maslow
--
A musician must make music, an artist must paint, a poet must write, if he
is to be ultimately at peace with himself.
- Abraham Maslow
I saw that their syntax is pretty similar.
Syntax is the least relevant part of a programming language. Although
you wouldn't guess it by the amount of arguing about it.
There are three pillars of a programming language:
* Semantics
* Type System
* Syntax
Of these, Semantics and Type System are the most important. They
actually determine the expressive power of a programming language,
they determine what the programming language can and cannot do, they
determine the paradigm(s) of the programming language, etc. E.g. if a
programming language has no higher-order and first-class subroutines,
you cannot easily fake that. But if you dislike the language's use of
semicolons, you can easily write a preprocessor.
I always like the Vala (Projects/Vala - GNOME Wiki!) and
Genie (Projects/Genie - GNOME Wiki!) programming languages as
an example: Vala is an object-oriented programming language based on
the GNOME GObject object system with a C#-inspired syntax. Genie is an
object-oriented programming language based on the GNOME GObject object
system with a Python-inspired syntax.
Genie was essentially created by taking the Vala compiler and
replacing its parser, keeping the entire rest of the compiler
unchanged. In fact, there aren't even two compilers. The `valac`
compiler is used for both programming languages:
Projects/Genie - GNOME Wiki!. As you can see, apart
from the parser, the two programming languages literally use the same
compiler; the two parsers construct the same syntax trees.
Is crystal developed by the same team behind ruby?
There is no relation between the designers of Crystal and the
designers of Ruby, nor is there a relation between the developers of
the Crystal implementation and the developers of any of the half-dozen
Ruby implementations.
There is not much of a relationship between Crystal and Ruby other
than a superficially similar syntax, which is because the designer of
Crystal is also a Ruby user who happens to like Ruby's syntax.
Or is the crystal just a "compiled ruby"?
There is no such thing as a "compiled language". Compilation and
interpretation are not traits of a programming language, they are
traits of a compiler or interpreter. Every programming language can be
implemented by a compiler and every programming language can be
implemented by an interpreter. For example, there are interpreters for
C and every currently existing mainstream implementation of ECMAScript
and Python has a compiler – some of them even multiple compilers.
More to the point: every currently existing implementation of Ruby has
at least one compiler: Opel *never* interprets the Ruby programming
language. It *always* compiles Ruby to ECMAScript. YARV *never*
interprets the Ruby programming language. It *always* compiles Ruby to
YARV bytecode, and then interprets *that*. It also compiles parts of
the YARV bytecode to native machine code. JRuby compiles Ruby to JRuby
IR, which it then either interprets or compiles to JVM bytecode (which
is in turn either interpreted or compiled to native machine code).
TruffleRuby parses Ruby into Truffle AST. The Truffle AST is then
interpreted by the Truffle framework's "specializing interpreter",
which is actually pretty much the same as compiling.
So, if all you want is "compiled Ruby", then any current mainstream
Ruby implementation will give you that.
Cheers
Bitfox <bitfox@bitfox.top> wrote:
There is not much of a relationship between Crystal and Ruby other
than a superficially similar syntax, which is because the designer of
Crystal is also a Ruby user who happens to like Ruby's syntax.
Well, it goes well beyond superficial similarities like syntax. Crystal
shares the same model: classes, single inheritance, mixins, requires,
ivars, keywords, etc. A lot of API is deliberately the same in both
languages. That is why some listings are both valid in Ruby and Crystal,
not only in the well-formed meaning of valid, but including their execution.
The Crystal team wanted something like Crystal, but they love Ruby, so they
decided it was not worthwhile to design something totally new, they took
Ruby as a starting point including all that.
On Sun, Feb 6, 2022 at 9:49 PM Jörg W Mittag <ruby-talk@joergwmittag.de> wrote:
I played around with Crystal for a little bit -- there is an analog to
Rails called "Lucky" which is really impressive.Check out the podcast "Chicago Crystal" as well for great infos.
In the end for me, there are benefits to interpretation for debugging and
hot-reloading, which are most important to me. So I lost interest. But the
language is pretty impressive.
It is still an opt-in feature in the source code (i.e. you have to compile
Crystal yourself, and tell the build process to build it) as it still has
some bugs, but Crystal does now also support interpreted execution, and an
interpreter-level debugger. In the little example pasted below, the
"debugger" call stops program execution and opens the debugger at that
point.
❯ cat dd.cr
debugger
finished = Channel(Nil).new
spawn do
puts "start loop doing stuff"
(rand(100) + 1).times do
sleep 0.05
end
puts "finished loop; sending signal that the program can exit"
finished.send(nil)
end
puts "waiting for work loop to finish"
finished.receive
puts "work finished"
❯ crystal i dd.cr
1: debugger
=> 2: finished = Channel(Nil).new
3:
4: spawn do
5: puts "start loop doing stuff"
6: (rand(100) + 1).times do
7: sleep 0.05
next
1: debugger
2: finished = Channel(Nil).new
3:
=> 4: spawn do
5: puts "start loop doing stuff"
6: (rand(100) + 1).times do
7: sleep 0.05
8: end
9: puts "finished loop; sending signal that the program can exit"
next
8: end
9: puts "finished loop; sending signal that the program can exit"
10: finished.send(nil)
11: end
12:
=> 13: puts "waiting for work loop to finish"
14: finished.receive
15: puts "work finished"
next
waiting for work loop to finish
9: puts "finished loop; sending signal that the program can exit"
10: finished.send(nil)
11: end
12:
13: puts "waiting for work loop to finish"
=> 14: finished.receive
15: puts "work finished"
next
start loop doing stuff
finished loop; sending signal that the program can exit
10: finished.send(nil)
11: end
12:
13: puts "waiting for work loop to finish"
14: finished.receive
=> 15: puts "work finished"
next
work finished
486:
487: # Terminates execution immediately, returning the given status code
488: # to the invoking environment.
489: #
490: # Registered `at_exit` procs are executed.
=> 491: def exit(status = 0) : NoReturn
492: status = Crystal::AtExitHandlers.run status
493: Crystal.ignore_stdio_errors { STDOUT.flush }
494: Crystal.ignore_stdio_errors { STDERR.flush }
495: Process.exit(status)
496: end
continue
Kirk Haines
On Sun, Feb 6, 2022 at 11:47 AM Sean Felipe Wolfe <ether.joe@gmail.com> wrote:
From: dd.cr:2:12 <Program>#dd.cr:
From: dd.cr:4:1 <Program>#dd.cr:
From: dd.cr:13:6 <Program>#dd.cr:
From: dd.cr:14:1 <Program>#dd.cr:
From: dd.cr:15:6 <Program>#dd.cr:
From: /usr/local/share/crystal/src/kernel.cr:491:19 <Program>#exit: