Feature #6611


Comments requested on implementation of set_parse_func

Added by cjheath (Clifford Heath) over 9 years ago. Updated almost 4 years ago.

Target version:



I've implemented Twister, a new mutation testing tool to replace Heckle.
It relies on a new hook into the Ruby parser, in order to modify what the
parser thinks it has seen.

Although I have written C extensions before, there are some aspects of
the Ruby core which I'm unfamiliar with and as a result don't know the right
way to handle. I'd like your comments, suggestions and improvements

In particular, I'd like to know the following:

1) Do you prefer that I move the literal strings (which occur once each) to #defined?

2) Will this line of code mess up the GC, and how should I fix that?

3) The set_parse_func is extern though it should be static, but I need to move
the rb_define_global_function out of thread.c. Can someone please tell me where I should
move it to, since there is no Init_Parser?

4) I think I should change set_parse_func to accept a flags argument and a block,
instead of assuming all flags, and taking a Proc. What are the downsides of using a
block instead of a Proc (does this reduce the number of Bindings that get created)?
How do I change set_parse_func to use a block?

The initial implementation of Twister is an extension to RSpec which adds the option
"--twist file-or-dir". It's still a bit rough - it needs to change the reporting on the twisted
runs that follow the first (untwisted) run - but it does prove then concept.

Clifford Heath, Data Constellation,
Agile Information Management and Design.


Also available in: Atom PDF