Another Phobos2 test

spir denis.spir at gmail.com
Tue Feb 8 17:03:41 PST 2011


On 02/08/2011 10:11 PM, bearophile wrote:
> Adam Ruppe:
>
>> I'm still trying to find something I like for this.
>
> Me too.

I like Adam's solution as well, but it's not perfect. The only other solution 
(like for constraints) would be a syntactic difference, but since we're limited 
by keyboard keys, this would instead certainly augment visual noise.

>> Error messages give a line number... but if there's still several
>> points of similar failure on that one line, it doesn't help as much
>> as it could.
>
> I understand. But splitting lines too much make the code a bit too much thin. I think a better solution is this request (from Lewis):
> http://d.puremagic.com/issues/show_bug.cgi?id=5521

Just done it for my parser. Once you get the line nr...

>> Maybe try ubyte[]?
>
> There are moments when I want an array of ubytes, other moments when I want an array of 8 bit chars, and other situations where I want a string of chars. An ubyte[] is a workaround for a type system not good enough yet.

After some more interrogations on the topic, I think there should be 4 somewhat 
related types.
* Bytes --> processing of data at plain binary/numeric level, no link to text 
(eg pixmap)
* ByteString --> single-byte charset text (ascii, latin-X,...)
On the implementation side, there no difference in data structure (not even 
code check like for D chars). But conceptually and semantically, these types 
are unrelated. (It would be a bit strange for me to process a pixmap using a 
type that exposes tons of text-processing functionality.)
ByteString is, I guess, more or less what Steven proposed.
* D' utf-8 string for i/O of unicode text without any manipulation (except concat).
* A Text like what I proposed for unicode text manipulation, conceptually an 
array of univoque text-characters (an array of no-copy-slices into a normalised 
utf-8 string).

>> Though, on the other hand, I've used the ncurses library which does
>> this kind of thing. The number of function names is obscene, and
>> the benefit is quite small.
>
> I agree that too many functions are going to give problems. But an "a" suffix is burden smaller than two names fully new.

I like your proposal. But -a suffixes are no good, use -Array or array- prefix 
instead.

>> I'm not convinced the parentheses are
>> a big deal. (Hell, I've done lisp before... and kinda liked it. :P)
>
> Scala, Ruby, ML-class languages like Haskell, etc have means to reduce parentheses count. Reducing syntax noise in functional-style code is something that a lot of people wants (me too). I have used Scheme, but parentheses tire me after a while.

Editors do that for you, don't they? Even for languages they don't know... 
(never been annoyed by paren counts, not even in Lisp-like slangs)

Denis
-- 
_________________
vita es estrany
spir.wikidot.com



More information about the Digitalmars-d mailing list