Live data from Hacker News

Compiling Ruby to machine language

patshaughnessy.net

31–40 of 56 posts

Re: Compiling Ruby to machine language

#31
post #11
post #5

IIRC MacRuby used to compile to native code on OSX using LLVM, and was supposed to support native OSX APIs and Objective-C frameworks. It always seemed like a neat idea, and a slick integration, but I guess Apple moved to Swift instead. I'll have to pick up a copy of this "Ruby Under a Microscope" book when the new version comes out. I've always liked Ruby, I just haven't had much chance to use it.

Typical. I may get absolutely destroyed for this, but being professionally proficient in a ton of languages, including Ruby and the ones I mention below, and the ones I'm about to mention: This sounds like Microsoft when they moved from VB6 to VB.Net. At least they have a good thing going with C# though. VB6 was quite an interesting beast. You could do basically everything that you could do in languages like C/C++, b…

I don't think it was too similar, TBH. Apple never took MacRuby as seriously as Microsoft took VB6, and it hadn't even had a 1.0 release when the single developer left Apple to work on RubyMotion.

I do agree it'd be interesting to have a GUI designer for Ruby. Does QML paired with QtRuby work?

In the distant past I had a book about FXRuby, but never used it much, and don't think it had a UI designer - it was just bindings to Fox Toolkit, which is lightweight, but not as well maintained as Qt or Gtk.

Re: Compiling Ruby to machine language

#32
post #24
post #5

IIRC MacRuby used to compile to native code on OSX using LLVM, and was supposed to support native OSX APIs and Objective-C frameworks. It always seemed like a neat idea, and a slick integration, but I guess Apple moved to Swift instead. I'll have to pick up a copy of this "Ruby Under a Microscope" book when the new version comes out. I've always liked Ruby, I just haven't had much chance to use it.

AFAIK, you can still use Objective-C and create apps for macOS, iOS, and iPadOS? The APIs previously used may not be available anymore.

I'm sure you can still use Objective-C, but MacRuby stopped being updated around 2011, and I don't know how well it'd support newer versions of OSX.

I dropped OSX long ago, so can't even try it out any more.

I wonder how much of the LLVM bits could be reused? I'm sure LLVM's changed a bunch in the last 15 years, too.

Re: Compiling Ruby to machine language

#33

Earlier quoted context omitted.

VB6 deserves the huge popularity it had, but the reason wasn't because of the language design, rather, its (extremely) rapid GUI application development. It was actually a two-edged sword - it facilitated writing spaghetti code. > You could do basically everything that you could do in languages like C/C++ As long as there is some form of memory access, any language can do basically everything that one can do in C/C++…

> As long as there is some form of memory access, any language can do basically everything that one can do in C/C++, but this doesn't make much sense. No VB6 had really easy COM integration which let you tap into a lot of Windows system components. The same code in C++ often required hundreds of lines of scaffolding, and I'm not exaggerating

FWIW, the pywin32 Python package and win32ole Ruby package have streamlined COM integration for Python and Ruby. Not quite as easy as VB6, but it's pretty close. I was even able to tab complete COM names in the Emacs Python REPL, but I remember it being a little buggy.

Re: Compiling Ruby to machine language

#34
post #4

I loved Ruby Under a Microscope when I first read it, and using that knowledge was able to have fun with some CTFs years ago. I haven't kept up with the evolving Ruby implementation internals, so I will sure as heck buy this new version of the book.

I used Ruby a lot from about 2002 to 2010. Haven't used it much since then, but this article really makes me want to get a copy of the upcoming version Ruby Under a Microscope.

Re: Compiling Ruby to machine language

#35

Really happy to see Pat keeping it up! His first Ruby under a Microscope book but also his blog posts are amazing and a major source of inspiration for me. I did meet him personally in a Euruko conference. Such a great person.

What a lovely comment - thank you!

whoa, the man himself! I second the praise, an all around excellent writer!

Re: Compiling Ruby to machine language

#36
post #11
post #5

IIRC MacRuby used to compile to native code on OSX using LLVM, and was supposed to support native OSX APIs and Objective-C frameworks. It always seemed like a neat idea, and a slick integration, but I guess Apple moved to Swift instead. I'll have to pick up a copy of this "Ruby Under a Microscope" book when the new version comes out. I've always liked Ruby, I just haven't had much chance to use it.

Typical. I may get absolutely destroyed for this, but being professionally proficient in a ton of languages, including Ruby and the ones I mention below, and the ones I'm about to mention: This sounds like Microsoft when they moved from VB6 to VB.Net. At least they have a good thing going with C# though. VB6 was quite an interesting beast. You could do basically everything that you could do in languages like C/C++, b…

Typical? Of whom?

You might get destroyed for this? Why?

I don’t know what either of those mean in this context, and I used VB6 for a couple years at least and have been programming ObjC and / or Swift since 2006, with some time in Rails over a couple years.

I’m extremely confused by your comment, it’s apparently near verboten in polite company, yet, manages to say nothing other than that while invoking several things of which I’m quite familiar.

If you are destroyed, I anticipate it will be for a quarter baked, horrible, analogy between ObjC/Swift (or is it Ruby/Swift)? and VB6/VB.NET that somehow has something to do with Ruby.

Re: Compiling Ruby to machine language

#38
post #24

Earlier quoted context omitted.

AFAIK, you can still use Objective-C and create apps for macOS, iOS, and iPadOS? The APIs previously used may not be available anymore.

I'm sure you can still use Objective-C, but MacRuby stopped being updated around 2011, and I don't know how well it'd support newer versions of OSX. I dropped OSX long ago, so can't even try it out any more. I wonder how much of the LLVM bits could be reused? I'm sure LLVM's changed a bunch in the last 15 years, too.

My understanding is that MacRuby relied on Apple's ill-fated attempts to migrate from reference counting to regular garbage collection. I would be surprised if GC still worked on modern arm64 macOS. RubyMotion later adopted ARC but then it's not really Ruby anymore.

Re: Compiling Ruby to machine language

#40
post #11
post #5

IIRC MacRuby used to compile to native code on OSX using LLVM, and was supposed to support native OSX APIs and Objective-C frameworks. It always seemed like a neat idea, and a slick integration, but I guess Apple moved to Swift instead. I'll have to pick up a copy of this "Ruby Under a Microscope" book when the new version comes out. I've always liked Ruby, I just haven't had much chance to use it.

Typical. I may get absolutely destroyed for this, but being professionally proficient in a ton of languages, including Ruby and the ones I mention below, and the ones I'm about to mention: This sounds like Microsoft when they moved from VB6 to VB.Net. At least they have a good thing going with C# though. VB6 was quite an interesting beast. You could do basically everything that you could do in languages like C/C++, b…

> At least they have a good thing going with C# though.

F# is pretty well-liked, too, isn't it?

Post reply on HN