Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

def does not return nil #2029

Closed
steveklabnik opened this Issue · 12 comments

5 participants

@steveklabnik
Collaborator

I'm not sure when exactly this would matter, but since @rkh brought it up on Twitter...

$ rvm use rbx-head
Using /Users/steve/.rvm/gems/rbx-head

steve at wireless-140 in ~/src/rails on master
$ irb
rubinius-2.0.0rc1 :001 > def foo
rubinius-2.0.0rc1 :002?>   end.nil?
 => false 
rubinius-2.0.0rc1 :003 > ^D%                                                         
steve at wireless-140 in ~/src/rails on master
$ rvm use 1.9.3
Using /Users/steve/.rvm/gems/ruby-1.9.3-p327

steve at wireless-140 in ~/src/rails on master
$ irb
1.9.3p327 :001 > def foo
1.9.3p327 :002?>   end.nil?
 => true 
@rkh
Collaborator

Here is a use case:

def foo(a, b = nil)
  launch_missiles if b
end

foo 10,

def bar
end
@rkh
Collaborator

No response yet? I guess Rubinius is dead ever since Evan left.

QED.

@evanphx
Owner
@brixen
Owner

I suggest you use PHP if you want compatibility with all the things done wrong in MRI.

@brixen brixen closed this
@rkh
Collaborator

:+1:

Has someone been working on a metacircular PHP implementation?

@brixen
Owner

I believe Facebook is the biggest commercial effort pushing PHP forward. You may be able to add a backend to the compiler that emits C code to emit PHP instead. I'd first consider emitting Javascript and then use CoffeeScript to emit Haskell, which should have a lot of tools for emitting PHP. However, you may want to emit Scala instead so you can benefit from the Clojure libraries on the JVM.

@ghost

lol.

@rkh
Collaborator

At least PHP supports fibers.

@brixen
Owner

It is impossible to compete with all the goodness that is PHP.

@rkh
Collaborator

Yeah, let's just give up.

@brixen
Owner

Well, I'm not willing to throw in the towel just yet. We return non-nil from def, after all.

@ddfreyne

I once started working on a tool that converted Ruby into PHP but I got so confused by this issue that I went ahead and made defs return the harraysh "php" instead.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.