STEP UP PHOBOS DEVELOPMENT 10 FOLD
Georg Wrede
georg.wrede at nospam.org
Tue Jun 13 03:51:46 PDT 2006
Da.
We need to step up Phobos development to ten times faster than now. The
current rate simply is not enough.
More comment at the end.
The quote below is only a case-in-point. (So do not comment that
specific issue here -- it is being discussed in D.learn !! )
===================================
>>>> So, for instance, "c3 a4" is the UTF-8 equivalent of U+00E4, "ä".
>>>> How do I combine the former two into a single "char"?
>>>>
>>>> Say I check if the char received from getc() is greater than 127
>>>> (outside ASCII) and if it is, I store it and the following char
>>>> in two ubytes. Now what? How do I get a char?
>>>>
>>> dchar std.utf.decode(char[],int)
>>>
>>> even if it can be quite clumsy. A hint is to use:
>>>
>>> std.utf.UTF8stride[c] to get the total number of bytes that are part
>>> of the starting token c.
>>
>> Thanks, that works. What I did was write a short function looking
>> like this:
>
> This only works for a small subset of Unicode...
>
>> dchar myGetchar(Stream s) {
>> char c = s.getc;
>>
>> // ASCII
>> if (c <= 127)
>> return c;
>> else {
>> // UTF-8
>> char[] str = new char[2];
>> str[0] = c;
>> str[1] = s.getc;
>
>
> For a more general implementation, change the last 3 lines to:
>
> char[6] str;
> str[0] = c;
> int n = std.utf.UTF8stride[c];
> if (n == 0xff)
> return cast(dchar)-1;; // corrupt string
> for (int i = 1; i < n; i++)
> str[i] = s.getc;
>
>>
>> // dummy var, needed by decode
>> size_t i = 0;
>> return decode(str, i);
>> }
>> }
>>
>> Using that in place of getc() pretty much does the trick.
>>
>> Unfortunately, when reading from files instead of stdin, I still run
>> into the problem of \r\n being converted to \r\r\n. I think
>> I know why, too:
>>
>> '\n' is being converted into \r\n because I'm on a Windows platform.
>> I use the following workaround:
>
>
> Yes. This is another proof that std.stream is lacking functionality.
> Because of this conversion, it is clear that std.stream isn't a binary
> stream, and as such, it ought to be either a utf-8, utf-16 or utf-32
> encoded text stream, and in those cases std.stream.getc should have a
> function returning a dchar, just as the above code.
===================================
We need more brain-cell-hours allocated to Phobos. And we need a
transparent way of getting those brain cells working on Phobos.
A suggestion:
Have the Phobos API listed on the web, and let everyone be able to put
their name next to any of the items.
A newsgroup (d.D.Phobos on DM, or something else on whatever other site)
would be used for communication.
IMPORTANT: newbie friendly instructions on recompiling Phobos after
one's changes -- simply _have_ to be available. (Unless they're newbie
friendly, then the smaller/easier things never get done cause we all
want to do "interesting" stuff, right?) Maybe I should even demand that
Walter slightly modify Phobos files (or whatever), so that recompiling
it by those new to D becomes a piece-of-cake.(**) It's the new guys who
spot most of the crap we're already immune to. (Gurus too would fix
things if it's easy enough.)
A Best Practice would be to post one's changes on the newsgroup for peer
review. And if well received, only then send them per e-mail to Walter.
(Somehow I feel an SCC repository is unneeded here. Especially since
every single change still would be incorporated by a single person
(Walter), and also get more or less edited anyhow<g>.)
--------
I WANT TO KEEP THIS SIMPLE, STUPID!
So, only the NG and the API list. Nothing else!
Zero administration. Zero bureaucracy. Zero assigned tasks.
Zero chores.
We need this to be so simple that it actually _works_.
And this is NOT to substitute anything existing. Rather, an additional
stream of "success and prosperity". :-D
Ah, almost forgot: the API list should allow anybody to put (and unput)
themselves there, even if others are working on the same thing already.
(I don't bother explaining this. I'm just telling.)
--------
(**) Going across the country for groceries never happens. Heck, you
don't even do that to get laid. Equally, noticing an easy-to-fix bug
doesn't make you work for two nights to get Phobos recompilable on your
machine.
We want 100 people doing 5 line fixes, because we "already have 5 people
doing 100 line fixes".
More information about the Digitalmars-d
mailing list