questions on PhanTango 'merger' (was Merging Tangobos into Tango) - long-term vision

BCS BCS at pathlink.com
Wed Oct 10 17:38:22 PDT 2007


Yigal Chripun wrote:
> BCS wrote:
> 
>>
>> Where the "OO is god" (oops, make that "good") stance puts me off is 
>> where it get in my way with things like (random example) RegEx. I 
>> don't want to new of an object and fill in all the members (etc, etc) 
>> just to run one regex match and then drop the object. I'd love to have 
>> both a RegEx class then compiles to some sort of fast state machine 
>> and a free function that does an on the fly interpretation.
>>
>> Before you even say it; That is a totally impractical way to do it. 
>> Why have two totally independent code bases doing (almost) exactly the 
>> same thing? At this point I'm just stating what I think would be 
>> ideal, not what I expect to get.
>>
>>
>> I know that's all a bit disjointed, but I hope it shows something of 
>> my reservations of switching to Tango.
>>
> 
> if i understand you correctly what you ask for is an implementation of 
> regEx as in Ruby.
> Ruby is totally OOP and RegEx is OOP based so we have classes an such to 
> represent the expression and the results, etc..
> on top of it it implement an interface wich allows you to use regEx as 
> you would normally expect (like in perl. for example you can use literal 
> expressions like /pattern/).  most of the time people use that. you can 
> use the underlying classes if you want but that of course is more 
> verbose (and probably most of the time is not needed).
> This is much better than two code bases, it gives us the benefits of 
> both styles and i think that's what lars suggests.
> the only thing left to do is figure out how a similar structure could be 
> implemented in D.

Actually what I want (and don't expect to get) is two independent 
implementation of RegEx. One would be OO the other would not share code 
with the OO version.

The point is that the OO version will probably have a RegEx compiler in 
the constructor that has a time and memory cost on the assumption that 
you will use the RegEx several times and the improved match performance 
will recoup that.

OTOH the free function one would not compile the RegEx. Rather it would 
interpret the string it's self and compare it to the text /as/ it reads 
though the pattern. The assumption here bing that many regex are simple 
and used once and that the fastest way to match them is to avoid 
overhead like the plague.

again I'm not arguing for this, just stating one case where "style" 
makes a difference



More information about the Digitalmars-d mailing list