Re: any html parser with d binding

2009-05-20 Thread BCS

Hello BCS,


Hello reimi,


i have 2 question here:

1) can anyone suggest good html parser with d binding?


IIRC ANTLR can generate D

If you dons't mind long compiles there is my dparse:
http://www.dsource.org/projects/scrapple/browser/trunk/dparser

And there is Enki:
http://www.dsource.org/projects/ddl/browser/trunk/enki

Other than that, I don't know of any



Oops, I missed the HTML bit :I




Re: any html parser with d binding

2009-05-20 Thread Robert Fraser

reimi gibbons wrote:

2) how reliable is bcd to create binding for c libraries?


C? Very reliable (unless it uses weird compiler directives). C++ is a 
bit trickier.


Re: any html parser with d binding

2009-05-20 Thread BCS

Hello reimi,


i have 2 question here:

1) can anyone suggest good html parser with d binding?



IIRC ANTLR can generate D

If you dons't mind long compiles there is my dparse: 
http://www.dsource.org/projects/scrapple/browser/trunk/dparser

And there is Enki: http://www.dsource.org/projects/ddl/browser/trunk/enki

Other than that, I don't know of any




Re: Simple file manipulation

2009-05-20 Thread Tyro[a.c.edwards]

On 5/20/2009 6:19 PM, BLS wrote:

Sam Hu wrote:

I looked up in D2 in std.stdio,std.file,std.cstream and std.stream and
try to find a very simple method which can read from a file once a
value other than once an entire row.I just can not find it maybe this
idea is wrong.Say how to simply read & write key/value pairs to and
from a file like this format:

//file "data.dat"
Tommy M 22

where the keys are name,gender and age while the values are Tommy,M ,22.

I found there is methods that can read from a file once an entire
row.But is there a simple method which can read once a value?In C++
one can do like this:

#include 
#include 
using namespace std;
ifstream inData;
inData.open("data.dat");
inData>>name;
inData>>gender;
inData>>age;

cout<<"Info:"<

IN D2 you can use std.file and slurp (cool name, beside)
slurp reads an entire file into an array.

// Load file; each line is an string followed by whitespace , another
//string followed by whitespace and a int.

auto a = slurp!(string, string, int)("data.dat", "%s %s %s");

Now you can go on an play a bit with the new range stuff. (std.range)

Enjoy, Björn


Unfortunately, that will not work. DMD fails with a Stack Overflow 
whenever upon encountering any of the string types (dstring, string, 
char[], wstring, etc...) being passed to this template. Works fine or 
other types as far as I can tell (including arrays).



import std.file;

void main()
{
auto a = slurp!(string)("", "%s");
}

results in Stack Overflow during compilation.


any html parser with d binding

2009-05-20 Thread reimi gibbons
i have 2 question here:

1) can anyone suggest good html parser with d binding?

2) how reliable is bcd to create binding for c libraries?

thanks.


Re: invariant

2009-05-20 Thread Jarrett Billingsley
On Wed, May 20, 2009 at 2:41 PM, Stewart Gordon  wrote:
> Jarrett Billingsley wrote:
>>
>> On Tue, May 19, 2009 at 8:55 PM, Stewart Gordon 
>> wrote:
>>>
>>> Jarrett Billingsley wrote:
>
> 

 Stewart, you've been here for years.  I *know* that you know that the
 D documentation is often incomplete or incorrect.  You're acting like
 you don't ;)
>>>
>>> Where do you get that idea from?
>>>
>>> Stewart.
>>
>> I don't know, the numerous comments and bugzilla reports about how
>> lacking you feel the spec - and the quality of its spelling - is?
>
> That might have something to do with your first two sentences, but I'm still
> lost for where you got the third from.
>
> Stewart.
>

"Why would invariant be deprecated before there's any documentation on
the meaning of immutable?"

Because the docs are usually out of sync with the compiler (which you
know) and because features and changes fall out of the sky with no
prior indication (which you also know)?


Re: invariant

2009-05-20 Thread Stewart Gordon

Jarrett Billingsley wrote:

On Tue, May 19, 2009 at 8:55 PM, Stewart Gordon  wrote:

Jarrett Billingsley wrote:



Stewart, you've been here for years.  I *know* that you know that the
D documentation is often incomplete or incorrect.  You're acting like
you don't ;)

Where do you get that idea from?

Stewart.


I don't know, the numerous comments and bugzilla reports about how
lacking you feel the spec - and the quality of its spelling - is?


That might have something to do with your first two sentences, but I'm 
still lost for where you got the third from.


Stewart.


Re: Simple file manipulation

2009-05-20 Thread BLS

Sam Hu wrote:

I looked up in D2  in std.stdio,std.file,std.cstream and std.stream and try to find 
a very simple method which can read from a file once a  value other than once an 
entire row.I just can not find it maybe this idea is wrong.Say how to simply read 
& write key/value pairs to and from a file like this format:

//file "data.dat"
Tommy M 22

where the keys are name,gender and age while the values are Tommy,M ,22.

I found there is methods that can read from a file once an entire row.But is 
there a simple method which can read once a value?In C++ one can do like this:

#include 
#include 
using namespace std;
ifstream inData;
inData.open("data.dat");
inData>>name;
inData>>gender;
inData>>age;

cout<<"Info:"<

IN D2 you can use std.file and slurp (cool name, beside)
slurp reads an entire file into an array.

// Load file; each line is an string followed by whitespace , another 
//string followed by whitespace and a  int.


auto a = slurp!(string, string, int)("data.dat", "%s %s %s");

Now you can go on an play a bit with the new range stuff. (std.range)

Enjoy, Björn


Simple file manipulation

2009-05-20 Thread Sam Hu
I looked up in D2  in std.stdio,std.file,std.cstream and std.stream and try to 
find a very simple method which can read from a file once a  value other than 
once an entire row.I just can not find it maybe this idea is wrong.Say how to 
simply read & write key/value pairs to and from a file like this format:

//file "data.dat"
Tommy M 22

where the keys are name,gender and age while the values are Tommy,M ,22.

I found there is methods that can read from a file once an entire row.But is 
there a simple method which can read once a value?In C++ one can do like this:

#include 
#include 
using namespace std;
ifstream inData;
inData.open("data.dat");
inData>>name;
inData>>gender;
inData>>age;

cout<<"Info:"<