Commit Graph

12 Commits

Author SHA1 Message Date
R. Tyler Croy 1d7c5b2fe6 Implement support for typedeaf'd class methods via #class_*
Fixes #6
2014-10-27 19:56:58 -07:00
R. Tyler Croy 6f273e2453 Raise immediately into the callers thread when using #future with invalid types 2014-10-25 18:06:57 -07:00
R. Tyler Croy 16fb43388b Avoid mutating the class variable `params` which broke calling a method with defaults repeatedly 2014-10-25 18:00:46 -07:00
R. Tyler Croy f56e423d52 Avoid failing specs if we cannot successfully load debugger/pry 2014-10-25 18:00:14 -07:00
R. Tyler Croy 4ac41b4de3 Refactor promise/future support to..work, using the right thread's varstack
References #7
2014-10-25 17:38:16 -07:00
R. Tyler Croy 78b513ea3d Implement support for declaring promise/future methods natively
Fixes #7
2014-10-25 16:43:11 -07:00
R. Tyler Croy cd4c83ee7f Add support for blocks with some caveats listed in the README
Fixes #5
2014-10-25 16:26:32 -07:00
R. Tyler Croy 9151370ad2 Make the typedeaf varstack thread- and instance-local
This should make sure that we're not popping the wrong values off of the
varstack when invoking our blocks across threads and object instances

Fixes #1
2014-10-25 15:15:02 -07:00
R. Tyler Croy 75368e89f9 Validate recursing into typedeaf methods works 2014-10-25 15:14:48 -07:00
R. Tyler Croy 03f5c71e56 Support setting default parameters in the DSL 2014-10-25 14:13:14 -07:00
R. Tyler Croy 4248e92f92 Add the type-checking basics 2014-10-24 01:11:16 -07:00
R. Tyler Croy eb4df666fc Initial cut of the "define" API with blocks
This has taken a lot of experimenting and research to get to, and it has to
resort to clever method_missing hacks because it appears to be absolutely
impossible to take a binding from a block and mutate it.

Original appraoch looked something like this:

    define :log, message: String do with
        # ... logic
    end

The `with` method couldn't access the right caller's binding (using clever
hacks: <http://rubychallenger.blogspot.com/2011/07/caller-binding.html>)

A follow up approach:

    define :log, message: String do with binding
        # ... logic
    end

Wouldn't work because the binding object ID inside the block would change as
soon as the with method would mutata it.

Thus the current approach, which is probably not going to perform worth a shit
2014-10-24 01:00:14 -07:00