rubyjs / therubyracer

Embed the V8 Javascript Interpreter into Ruby
1.66k stars 193 forks source link

normalize value handling #368

Closed cowboyd closed 9 years ago

cowboyd commented 9 years ago

This pull requests normalizes value handling in two ways. First, gets rid of the special cases for Undefined and Null which are actually represented as objects inside v8, so should be represented as objects in our C layer. (we should also add at some point impmente V8::C::V8::Undefined(@isolate) and V8::C::V8::Null(@isolate) in order to retreive those values explicitly)

Second, it makes the normal Value::operator VALUE() perform the thunk-down on type so that when returning a v8::Value to Ruby, there's nothing more to do than use the normal Value(isolate, handle) constructor to get the most specific Ruby class.

cowboyd commented 9 years ago

@stormbreakerbg how are you feeling about this one?

georgyangelov commented 9 years ago

I love it :)

cowboyd commented 9 years ago

Awesome! Merged.