Higgs, a JavaScript JIT done in D

Dmitry Olshansky dmitry.olsh at gmail.com
Tue Feb 5 11:03:59 PST 2013


05-Feb-2013 23:01, Andrej Mitrovic пишет:
> On 2/5/13, Andrei Alexandrescu <SeeWebsiteForEmail at erdani.org> wrote:
>> Care for a shotgun search/replace pull request?
>
> Looking at the implementation:
>
> string text(T...)(T args)
> {
>      return textImpl!string(args);
> }
>
> private S textImpl(S, U...)(U args)
> {
>      S result;
>      foreach (i, arg; args)
>      {
>          result ~= to!S(args[i]);
>      }
>      return result;
> }
>
> I can see 2 optimizations here:
>
> 1. Use a static if to replace the append operator with a simple return
> when there's only one argument
> 2. Use Appender instead of a regular string for multiple arguments.
>
> Unfortunately #2 won't fly because std.regex uses text and it expects
> it to be safe, but Appender isn't safe.
>

Time to make Appender @trusted and linch the author if it's not that 
safe inside? ;)

But seriously it would silently allow @system OutputRanges... @trusted 
needs re-design.

-- 
Dmitry Olshansky


More information about the Digitalmars-d-announce mailing list