Samples directory

Brad Roberts braddr at puremagic.com
Tue May 18 19:51:26 PDT 2010


On 5/18/2010 11:33 AM, Piotrek wrote:
> W dniu 18.05.2010 06:50, Brad Roberts pisze:
>> Would anyone be interested in taking on the task of looking at the
>> existing
>> samples and modernizing them?  Some should likely be junked as not
>> terribly
>> educational examples.  Likely more should be added to illustrate other
>> best
>> practices.
>>
>> They can be found here:
>>
>>    http://www.dsource.org/projects/phobos/browser/samples/d
>>
>> Arguably they need to be versioned along with each branch of the
>> language, so
>> assume they'll be moved to:
>>
>>   
>> http://www.dsource.org/projects/phobos/browser/branches/phobos-1.x/samples
>>
>>
>> and
>>
>>    http://www.dsource.org/projects/phobos/browser/trunk/samples
>>
>> I see no good reason to keep the 'd' part of the directory name, it's
>> not like
>> the dmd .zip files are going to suddenly start shipping other languages.
>>
>> See also:
>>   http://d.puremagic.com/issues/show_bug.cgi?id=2613
>>
>> - Brad
> 
> Hi Brad,
> 
> I'm interested. Although I'm not so much experienced in D it would be
> great opportunity to stay in line with latest D 2.0 features.
> 
> 
> I even have some mist ideas about architecture of the whole business .
> 
> (Keepin in mind that D should be a system and scripting language in one
> - the first one in computer history)
> 
> Every module from std should have its corresponding imports within
> samples (let say 2-5 at least). There should be comparable example in
> Ruby/Python, C++. (I would exclude C# since D is near this M$ creature
> but it's far from Windows and Dots slavery).

While not a bad goal, probably well beyond what is really needed for a 'samples'
directory.

> Comparison should be done int three dimensions.
> - speed
> - bytes of code
> - memory usage
> 
> (yes, all this is like quasi shootout project).
> 
> (I would be nice for D to get all pole positions - however overall win
> is enough)

This part I actively disagree with.  Samples don't need to be benchmarks.  Some
showing how to do some benchmarking of ones code, sure.  But the point of sample
code is to help a new person get their feet wet with the language, the compiler,
the tools, etc.

Not that there's not value in benchmarking, there certainly is.  But that's not
what I expect from the samples packaged with the compiler to be.

> I would set-up a project on some git host (github) , automate all things
> and publish results.
> 
> It will take some time and as you can see a risk of failure is rather
> high. However I thought about contributing to D and you bring up a good
> idea. I will stay away from the official repository to not break anything.
> 
> I'm starting work right now (with existing examples) but don't expect
> too much from it.
> If anyone has some a good argument for me to stop I'm listing.

I don't want to stop you.. but maybe redirect the enthusiasm a little?

> Cheers
> Piotrek
> 



More information about the Digitalmars-d mailing list