Hacker News new | ask | show | jobs
by lectrick 3801 days ago
I understand the technical reasons behind it.

First/early impressions do matter, however.

But also, how is bundling that explanation into the stringified version of the "exit" object not as magicky as Ruby putting an "exit" method on Kernel which is in the root namespace of the REPL and exits the current process (with an optional exit code)?

2 comments

Slight correction, `exit` in IRB is actually not the same as `Kernel.exit` (as IRB actually allow IRB sessions to be nested, using `Kernel.exit` would quit the whole program rather than just the current session). It is actually an alias of `IRB::ExtendCommandBundle#irb_exit` that throws `IRB_EXIT` to stop the eval loop of the current session and allow some pre-exit hooks to be assigned to it.
"Slight correction", good one haha

That said, technically correct is best correct, so here is your upvote!

Ruby's "exit" doesn't have to be as magicky owing to how simply typing "exit" in Ruby is a valid way to call a function with no arguments. The problem, if you can even call it that, is that Python doesn't have the separation between functions/methods on the one hand and procs on the other.

That is a critical difference that needs to be kept in mind.

Edit: grammar fixes. I didn't reread by comment before posting. :-/