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

def does not return nil #2029

Closed
steveklabnik opened this issue Nov 18, 2012 · 12 comments
Closed

def does not return nil #2029

steveklabnik opened this issue Nov 18, 2012 · 12 comments
Labels

Comments

@steveklabnik
Copy link
Member

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
Copy link
Member

rkh commented Nov 18, 2012

Here is a use case:

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

foo 10,

def bar
end

@rkh
Copy link
Member

rkh commented Nov 18, 2012

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

QED.

@evanphx
Copy link
Member

evanphx commented Nov 18, 2012

I can't see anyone depending on def's return value and the Rubinius behavior is better. Can you show me real world code that has a problem with returning a CompiledMethod?

  • Evan // via iPhone

On Nov 18, 2012, at 7:38 AM, Konstantin Haase notifications@github.com wrote:

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

QED.


Reply to this email directly or view it on GitHub.

@brixen
Copy link
Member

brixen commented Nov 18, 2012

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

@brixen brixen closed this as completed Nov 18, 2012
@rkh
Copy link
Member

rkh commented Nov 18, 2012

👍

Has someone been working on a metacircular PHP implementation?

@brixen
Copy link
Member

brixen commented Nov 18, 2012

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
Copy link

ghost commented Nov 18, 2012

lol.

@rkh
Copy link
Member

rkh commented Nov 18, 2012

At least PHP supports fibers.

@brixen
Copy link
Member

brixen commented Nov 18, 2012

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

@rkh
Copy link
Member

rkh commented Nov 18, 2012

Yeah, let's just give up.

@brixen
Copy link
Member

brixen commented Nov 18, 2012

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

@denisdefreyne
Copy link

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
Labels
Projects
None yet
Development

No branches or pull requests

5 participants