"D Programming Language"

2010-06-08 Thread Patrick Byrne

Amazon (UK) tells me that publication of this book is delayed. Is it still 
coming soon, please?

--
Patrick Byrne


Re: "D Programming Language"

2010-06-08 Thread Lars T. Kyllingstad
On Tue, 08 Jun 2010 11:23:23 +0100, Patrick Byrne wrote:

> Amazon (UK) tells me that publication of this book is delayed. Is it
> still coming soon, please?

I also ordered it from Amazon UK, and got the same message.  But the book 
is, as far as I know, finished and printed.  So I suppose it's mostly a 
matter of transportation time. :)

-Lars


Re: "D Programming Language"

2010-06-08 Thread Robert Clipsham

On 08/06/10 11:23, Patrick Byrne wrote:

Amazon (UK) tells me that publication of this book is delayed. Is it
still coming soon, please?

--
Patrick Byrne


I ordered it from amazon.com, it was half the priceof the UK version ;) 
I've had no delay message about it for a while now, the last one I got 
said "June 25 2010 - August 04 2010" though... Guess we'll see though!


Given that it's already been dispatched from the printers, I'm quietly 
optimistic it'll arrive before then.


Robert


Re: "D Programming Language"

2010-06-08 Thread Lars T. Kyllingstad
On Tue, 08 Jun 2010 13:00:51 +0100, Robert Clipsham wrote:

> On 08/06/10 11:23, Patrick Byrne wrote:
>> Amazon (UK) tells me that publication of this book is delayed. Is it
>> still coming soon, please?
>>
>> --
>> Patrick Byrne
> 
> I ordered it from amazon.com, it was half the priceof the UK version ;)


I don't know when you ordered it, but that has changed now, at least.  At 
amazon.co.uk it costs £18.50, while at amazon.com it sells for $42.70 -- 
roughly £29.  Also, for Europeans, the delivery cost is lower if you 
order from UK.

-Lars


Re: "D Programming Language"

2010-06-08 Thread Robert Clipsham

On 08/06/10 13:12, Lars T. Kyllingstad wrote:

I don't know when you ordered it, but that has changed now, at least.  At
amazon.co.uk it costs £18.50, while at amazon.com it sells for $42.70 --
roughly £29.  Also, for Europeans, the delivery cost is lower if you
order from UK.

-Lars


I ordered it a few weeks after it was up on Amazon, at the time it was 
about £30 in the UK and $42.70 in the US (I know they're roughly the 
same now, it worked out about £10 cheaper at the time though). As for 
delivery cost, I always wait until there's a selection of things I want 
to buy to get free delivery ;)


Master Thesis using D Programming language.

2020-08-24 Thread Tariq Siddiqui via Digitalmars-d-learn

Hello everyone,

I am looking for a master thesis topic using D Programming 
language. Earlier I choose Design by Introspection, but I did not 
find enough material in academic journals. DbI total material 
which I found is DConf Andrei talk and the similar talk at Google 
campus, which starts with 50 Deutsche Mark story and ends with 
explaining PbD, DbI and other Dlang internals. No doubt that 
Andrei's discussion was great. DbI as a topic is excellent, but 
as per my university requirements, I was not able to find five 
articles in the last five years in any academic journal, to start 
the initial discussion about the research topic.


I am still opened with my topic, next week, I have to submit my 
draft proposal. Till now, I did not meet my dissertation advisor.


I am looking for something practical and less theoretical. I have 
found some thesis done using Rust, you guys as a language expert 
can these below projects be achievable using D Programming 
language.


http://www.barrelfish.org/publications/ma-foellmic-bfrust.pdf
https://www.diva-portal.org/smash/get/diva2:1238890/FULLTEXT01.pdf
https://github.com/Gankra/thesis/blob/master/thesis.pdf

Regards,
Tariq Siddiqui.



The D Programming Language page 161.

2013-11-13 Thread Tor Einar Tønnessen

Hello.

I am trying to learn D using (among other things) "The D 
Programming Language" book.


On page 161 it says:

snippet...

void writeln(string a0, int a1, string a2, int[new] a3) {

...snippet

I am wondering about the expression "int[new] a3"

What does that mean? I have checked, and it does not compile with 
the current compiler - it says: Error: basic type expected, not ] 
...


It is not mentioned in the errata for the book.


Tor Einar


Error in 'The D Programming Language' (2010)?

2016-01-11 Thread asdfa via Digitalmars-d-learn
I have copied more or less verbatim an example from The D 
Programming Language, under 1.4.3 Counting Frequencies. Lambda 
Functions


This is the code

import std.stdio,
   std.string;

void main()
{
  uint[string] freqs;
  // Compute counts
  foreach (line; stdin.byLine())
  {
foreach (word; split(strip(line)))
{
  ++freqs[word.idup];
}
  }

  // Print counts
  string[] words = freqs.keys;
  sort!((a, b) { return freqs[a] > freqs[b]; })(words); // won't 
compile 

  foreach (word; words)
  {
writefln("%6u\t%s", freqs[word], words);
  }
}

Both DMD and GDC complain, saying
Error: template instance sort!((a, b)
{
return freqs[a] > freqs[b];
}
) template 'sort' is not defined


Have I made a mistake, or has the D syntax perhaps changed since 
the book was published?
I don't understand this functional voodoo stuff, so I don't have 
the faintest clue how to fix it myself


Anyone know how to fix this?


De Facto standard for D programming language

2016-04-15 Thread Napster via Digitalmars-d-learn
I would like to start learning the De Facto standard. which book 
or document  would you use?


http://erdani.com/index.php/books/tdpl/

or

https://dlang.org/spec/intro.html

which one would you call de facto standard?



Re: Master Thesis using D Programming language.

2020-08-24 Thread James Blachly via Digitalmars-d-learn

On Monday, 24 August 2020 at 19:56:49 UTC, Tariq Siddiqui wrote:

Hello everyone,

I am looking for a master thesis topic using D Programming 
language. Earlier I choose Design by Introspection, but I did 
not find enough material in academic journals. DbI total 
material which I found is DConf Andrei talk and the similar 
talk at Google campus, which starts with 50 Deutsche Mark story 
and ends with explaining PbD, DbI and other Dlang internals. No 
doubt that Andrei's discussion was great. DbI as a topic is 
excellent, but as per my university requirements, I was not 
able to find five articles in the last five years in any 
academic journal, to start the initial discussion about the 
research topic.


I am still opened with my topic, next week, I have to submit my 
draft proposal. Till now, I did not meet my dissertation 
advisor.


I am looking for something practical and less theoretical. I 
have found some thesis done using Rust, you guys as a language 
expert can these below projects be achievable using D 
Programming language.


http://www.barrelfish.org/publications/ma-foellmic-bfrust.pdf
https://www.diva-portal.org/smash/get/diva2:1238890/FULLTEXT01.pdf
https://github.com/Gankra/thesis/blob/master/thesis.pdf

Regards,
Tariq Siddiqui.


Well, what would you like to study? Generally, the thesis will be 
of a topic that is (a) great interest to you and (b) has room for 
improvement in the field.


The theses you listed cover OS development, memory safe kernel 
programming, and safety generally, respectively. Is this the area 
you wish to work in?  What about other areas, such as 
concurrency, message passing, high performance, Type Theory, etc.?


You mentioned Design by Introspection hard to find material 
about. What if you broaden this a bit and consider the topic of 
metaprogramming more generally?


Best of luck to you




Re: Master Thesis using D Programming language.

2020-08-25 Thread aberba via Digitalmars-d-learn

On Tuesday, 25 August 2020 at 16:52:17 UTC, aberba wrote:

On Monday, 24 August 2020 at 19:56:49 UTC, Tariq Siddiqui wrote:
Academic don't know innovation. Only history :)


Academia*


Re: Master Thesis using D Programming language.

2020-08-25 Thread aberba via Digitalmars-d-learn

On Monday, 24 August 2020 at 19:56:49 UTC, Tariq Siddiqui wrote:

Hello everyone,

I am looking for a master thesis topic using D Programming 
language. Earlier I choose Design by Introspection, but I did 
not find enough material in academic journals. DbI total 
material which I found is DConf Andrei talk and the similar 
talk at Google campus, which starts with 50 Deutsche Mark story 
and ends with explaining PbD, DbI and other Dlang internals. No 
doubt that Andrei's discussion was great. DbI as a topic is 
excellent, but as per my university requirements, I was not 
able to find five articles in the last five years in any 
academic journal, to start the initial discussion about the 
research topic.

Academic don't know innovation. Only history :)



I am still opened with my topic, next week, I have to submit my 
draft proposal. Till now, I did not meet my dissertation 
advisor.


Metaprogramming as suggested sounds interesting upon second 
thought. On Wikipedia, only D and C++ seems to have sufficient 
implementation among mainstream languages. With D's being 
exceptionally capable.


So you might want to do something around that...and how it 
impacts software development.




I am looking for something practical and less theoretical. I 
have found some thesis done using Rust, you guys as a language 
expert can these below projects be achievable using D 
Programming language.


Yep. Its does. Metaprogramming really has a very significant 
benefit in practice. And disign by introspection is one way it 
can be used.




Re: Master Thesis using D Programming language.

2020-08-25 Thread Arun via Digitalmars-d-learn

On Monday, 24 August 2020 at 19:56:49 UTC, Tariq Siddiqui wrote:

Hello everyone,

I am looking for a master thesis topic using D Programming 
language. Earlier I choose Design by Introspection, but I did 
not find enough material in academic journals. DbI total 
material which I found is DConf Andrei talk and the similar 
talk at Google campus, which starts with 50 Deutsche Mark story 
and ends with explaining PbD, DbI and other Dlang internals. No 
doubt that Andrei's discussion was great. DbI as a topic is 
excellent, but as per my university requirements, I was not 
able to find five articles in the last five years in any 
academic journal, to start the initial discussion about the 
research topic.


I am still opened with my topic, next week, I have to submit my 
draft proposal. Till now, I did not meet my dissertation 
advisor.


I am looking for something practical and less theoretical. I 
have found some thesis done using Rust, you guys as a language 
expert can these below projects be achievable using D 
Programming language.


http://www.barrelfish.org/publications/ma-foellmic-bfrust.pdf
https://www.diva-portal.org/smash/get/diva2:1238890/FULLTEXT01.pdf
https://github.com/Gankra/thesis/blob/master/thesis.pdf

Regards,
Tariq Siddiqui.


D for a @safer Linux Kernel was worked on by Alexandru Militaru: 
https://www.youtube.com/watch?v=weRSwbZtKu0


You can also browse the previous GSoC proposals at 
https://wiki.dlang.org/GSOC_2019_Ideas and 
https://wiki.dlang.org/GSOC_2018_Ideas of which some might 
qualify as masters thesis. These are pretty hands on requiring 
good understanding of the theory as well.


D blog had a similar post recently. 
https://dlang.org/blog/2020/08/23/symmetry-autumn-of-code-2020-projects-and-participants/


--
Arun


Re: The D Programming Language page 161.

2013-11-13 Thread Uplink_Coder
I guess that new should be length as it represents as an integer 
variable


Re: The D Programming Language page 161.

2013-11-13 Thread Adam D. Ruppe
On Wednesday, 13 November 2013 at 08:16:34 UTC, Tor Einar 
Tønnessen wrote:

void writeln(string a0, int a1, string a2, int[new] a3) {


Around the time the book was written, there was a debate as to if 
we should make dynamic arrays and slices two different types. 
T[new] was the proposed syntax for a dynamic array, leaving T[] 
to be a slice.


The reasoning would be to separate a window into the memory block 
- the slice - from the memory block itself, the array. This is 
the case with static arrays: int[10] != int[], but not with 
dynamic arrays. The advantage of the separation would be to help 
keep track of the array's ownership - appending to a T[new] could 
resize the block, whereas appending to a T[] would be a whole new 
allocation, among other things.


However, minds were changed and T[new] never actually came to be. 
Instead, slice append was changed to address the ownership 
stomping problem, it asks the gc for capacity at the end. The old 
problem is solved, and it didn't break any code by introducing a 
new type... everyone wins, except for the few things written 
about T[new] that weren't updated.


This article goes into the append to slice problem and solution 
in more detail:

http://dlang.org/d-array-article.html


Bottom line, any time you see T[new] in the book, just replace it 
with T[] and it should all work. So int[] a3 ought to compile and 
do the same thing described.


BTW, I don't see this item in the list, but on Andrei's website, 
there's a list of little changes since the printing:

http://erdani.com/index.php?cID=109


Re: The D Programming Language page 161.

2013-11-13 Thread Andrej Mitrovic
On 11/13/13, Adam D. Ruppe  wrote:
> On Wednesday, 13 November 2013 at 08:16:34 UTC, Tor Einar
> Tønnessen wrote:
>> void writeln(string a0, int a1, string a2, int[new] a3) {
>
> Around the time the book was written, there was a debate as to if
> we should make dynamic arrays and slices two different types.
> T[new] was the proposed syntax for a dynamic array, leaving T[]
> to be a slice.

I think it was just an oversight that it was left in the book, I don't
recall reading about that syntax on any other page.


Doubt about this book: The D Programming Language

2018-12-16 Thread Marko via Digitalmars-d-learn
On Amazon The D Programming Language has good reviews but it's 8 
years old. So is this book still relevant today?


Would you recommend another book?

PS: I am already a programmer writing mainly in C and C#.

Thanks,

Marko.


Re: Error in 'The D Programming Language' (2010)?

2016-01-11 Thread Ali Çehreli via Digitalmars-d-learn

On 01/11/2016 04:28 PM, asdfa wrote:

> Both DMD and GDC complain, saying
> Error: template instance sort!((a, b)
> {
> return freqs[a] > freqs[b];
> }
> ) template 'sort' is not defined

That issue is already in the errata:

  http://erdani.com/tdpl/errata/

Add the following line to fix:

import std.algorithm;

Ali



Re: Error in 'The D Programming Language' (2010)?

2016-01-11 Thread asdfa via Digitalmars-d-learn

On Tuesday, 12 January 2016 at 00:36:15 UTC, Ali Çehreli wrote:

On 01/11/2016 04:28 PM, asdfa wrote:

> Both DMD and GDC complain, saying
> Error: template instance sort!((a, b)
> {
> return freqs[a] > freqs[b];
> }
> ) template 'sort' is not defined

That issue is already in the errata:

  http://erdani.com/tdpl/errata/

Add the following line to fix:

import std.algorithm;

Ali


Thank you so much! It works now

well it does after I changed
writefln("%6u\t%s", freqs[word], words);

to
writefln("%6u\t%s", freqs[word], word);

(stupid mistake I made copying)


Programming in D vs The D Programming Language

2016-03-13 Thread gour via Digitalmars-d-learn

Hello,

after quite some time I'm returning to D being fed up with some 
other languages to become more ready for writing open-source 
multi-platform desktop app(s)...


I already own copy of Andrei's The D Programming Language book, 
but never went fully through it, but I see in the meantime 
Programming in D by Ali was released so I wonder:


a) how much is Andrei's book still relevant?

b) whether PiD is recommended one to start with D *today* ?

Btw, I prefer hardcopy books, if possible, and interested whether 
there is plan to release PiD with hardcover since several 
reviewers @Amazon reported that the glued used to bind the book 
is not the best*



Sincerely,
Gour


Re: De Facto standard for D programming language

2016-04-15 Thread jmh530 via Digitalmars-d-learn

On Friday, 15 April 2016 at 17:51:41 UTC, Napster wrote:
I would like to start learning the De Facto standard. which 
book or document  would you use?


http://erdani.com/index.php/books/tdpl/

or

https://dlang.org/spec/intro.html

which one would you call de facto standard?


If I were learning D from the beginning, I would read Ali's book:
http://ddili.org/ders/d.en/index.html

I had read TDPL first and then from spec pages before finding his 
book. His book probably doesn't cover everything, so it's worth 
looking at those other sources as well.


Re: De Facto standard for D programming language

2016-04-15 Thread Napster via Digitalmars-d-learn

On Friday, 15 April 2016 at 18:19:44 UTC, jmh530 wrote:

On Friday, 15 April 2016 at 17:51:41 UTC, Napster wrote:
I would like to start learning the De Facto standard. which 
book or document  would you use?


http://erdani.com/index.php/books/tdpl/

or

https://dlang.org/spec/intro.html

which one would you call de facto standard?


If I were learning D from the beginning, I would read Ali's 
book:

http://ddili.org/ders/d.en/index.html

I had read TDPL first and then from spec pages before finding 
his book. His book probably doesn't cover everything, so it's 
worth looking at those other sources as well.


I am writing a survey paper about D programming language.  I want 
to use De Facto standard in my paper. I  am not sure which one 
is? Both look the same.


Re: De Facto standard for D programming language

2016-04-15 Thread Ali Çehreli via Digitalmars-d-learn

On 04/15/2016 11:31 AM, Napster wrote:


I am writing a survey paper about D programming language.  I want to use
De Facto standard in my paper. I  am not sure which one is? Both look
the same.


  https://dlang.org/spec/intro.html

is it. TDPL is behind some of D changes at this point.

Ali



Re: De Facto standard for D programming language

2016-04-15 Thread Ali Çehreli via Digitalmars-d-learn

On 04/15/2016 11:19 AM, jmh530 wrote:
> On Friday, 15 April 2016 at 17:51:41 UTC, Napster wrote:
>> I would like to start learning the De Facto standard. which book or
>> document  would you use?
>>
>> http://erdani.com/index.php/books/tdpl/
>>
>> or
>>
>> https://dlang.org/spec/intro.html
>>
>> which one would you call de facto standard?
>
> If I were learning D from the beginning, I would read Ali's book:
> http://ddili.org/ders/d.en/index.html
>
> I had read TDPL first and then from spec pages before finding his book.
> His book probably doesn't cover everything, so it's worth looking at
> those other sources as well.

Putting Phobos aside, I aim at including every keyword and pseudo 
keyword and every feature in the book. Even if I decide not to cover a 
particular keyword or feature, it should exist in the index. If you 
catch an omission please let me know.


The benefit of an online book is that it can be up-to-date very quickly. 
For example, reduce() has already been replaced with fold() that came 
with 2.071: :)


  http://ddili.org/ders/d.en/ranges.html#ix_ranges.fold,%20std.algorithm

(The CreateSpace edition has been updated as well but it takes a while 
for the readers see that change.)


Having said that, there are some omissions of how some features interact.

Ali



Re: De Facto standard for D programming language

2016-04-15 Thread jmh530 via Digitalmars-d-learn

On Friday, 15 April 2016 at 18:41:23 UTC, Ali Çehreli wrote:


Having said that, there are some omissions of how some features 
interact.




I think it is a fantastic resource and have made much use out of 
it. I hope you keep updating it.


It just happens that there are always some random quirks in D 
that I only notice if I pay really close attention to the spec. 
For instance, until Andrei pointed it out today I didn't realize 
that virtual member functions can't be templates. I've probably 
seen the line in the spec page, but didn't process it fully 
because the examples they use in there are not the best. At least 
with your book, everything is very readable with good examples.


Re: D programming language overview video on Youtube

2023-12-21 Thread aberba via Digitalmars-d-learn

On Sunday, 17 December 2023 at 22:39:56 UTC, Witold Baryluk wrote:
I made a bit random video on D lang for noobs, and people who 
might be interested.


If you program more than one hour in D, do not watch it, but if 
you just found about D, feel free to check it out.


It is not too short, and unscripted, but should give general 
feel of D, its power, major features (with some live coding, 
and exploration of various aspects in real world, including 
debugging), maybe for people who just want to see what it is 
about. And high level overview of the project and features.


https://www.youtube.com/watch?v=_7Xg-E0NoNU


While I am not great at making videos, I think it is good to 
promote D any way possible, as it can compete in many places, 
like Python, Julia, Zig, but people rarely hear about D lang 
these days.


👍


Does D programming language have work steal queue?

2022-05-22 Thread zoujiaqing via Digitalmars-d-learn

Does D language have task steal queue?
The requirements are high-performance, lock-free, and thread-safe.


Re: Broken link to D Programming Language Specification

2012-04-21 Thread Jakob Ovrum
On Saturday, 21 April 2012 at 20:56:27 UTC, Kamil Slowikowski 
wrote:
This link fails to load for me: 
http://digitalmars.com/d/2.0/dlangspec.mobi


I'd really like a copy for myself. Can I get it elsewhere?


The eBook is a compilation of the pages on dlang.org, which 
sources are hosted on Github:



https://github.com/D-Programming-Language/d-programming-language.org


To generate the eBook, run:

make dlangspec.mobi

You will need the catdoc tool from the tools collection:

https://github.com/D-Programming-Language/tools

You will also need the kindlegen command line tool.

The link should really be fixed too, but I'm not sure where it 
should point, and I'm not sure if dlangspec.mobi is part of the 
'all' makefile target so that it's automatically built every 
time...


Re: Doubt about this book: The D Programming Language

2018-12-16 Thread Steven Schveighoffer via Digitalmars-d-learn

On 12/16/18 1:37 PM, Marko wrote:
On Amazon The D Programming Language has good reviews but it's 8 years 
old. So is this book still relevant today?


Mostly, yes. And it's a pretty good book, even if it has some outdated 
parts. There's errata somewhere too.




Would you recommend another book?


I highly recommend this book (available online for free or you can 
purchase a hard copy): http://ddili.org/ders/d.en/index.html


It is continually updated by Ali, so it should be up to date with the 
latest compiler.




PS: I am already a programmer writing mainly in C and C#.


I hope you feel right at home here :) But I must warn you, if you're 
anything like me, you will hate having to go back to another language.


-Steve


Re: Doubt about this book: The D Programming Language

2018-12-16 Thread bauss via Digitalmars-d-learn
On Sunday, 16 December 2018 at 19:57:08 UTC, Steven Schveighoffer 
wrote:


I hope you feel right at home here :) But I must warn you, if 
you're anything like me, you will hate having to go back to 
another language.


-Steve


I think that's how most people start to feel when they start 
using D a lot.


I know I have over the past few years when I've started to use D 
for 99% of everything I do.


Re: Doubt about this book: The D Programming Language

2018-12-16 Thread bachmeier via Digitalmars-d-learn

On Sunday, 16 December 2018 at 18:37:15 UTC, Marko wrote:
On Amazon The D Programming Language has good reviews but it's 
8 years old. So is this book still relevant today?


Would you recommend another book?

PS: I am already a programmer writing mainly in C and C#.

Thanks,

Marko.


I can recommend D Cookbook
https://www.packtpub.com/application-development/d-cookbook

and Learning D
https://www.packtpub.com/application-development/learning-d

Sometimes Packt has sales and you can get them pretty cheap. They 
are rather different books, but both are well written, and they 
go into reasonable depth on the topics they cover, unlike a lot 
of programming books I've read.


Re: Doubt about this book: The D Programming Language

2018-12-16 Thread Ali Çehreli via Digitalmars-d-learn

On 12/16/2018 11:57 AM, Steven Schveighoffer wrote:
> On 12/16/18 1:37 PM, Marko wrote:
>> On Amazon The D Programming Language has good reviews but it's 8 years
>> old. So is this book still relevant today?

I would still enjoy reading that book but some parts do not match current D.

> http://ddili.org/ders/d.en/index.html
>
> It is continually updated by Ali, so it should be up to date with the
> latest compiler.

I've been slacking lately. :/

HTML: Mosty up to date with 2.083 and code samples were compiled with it

PDF: ditto

Kindle and other e-books: Last updated on May 2017 :(

Ali



Re: Doubt about this book: The D Programming Language

2018-12-16 Thread Jani Hur via Digitalmars-d-learn

On Sunday, 16 December 2018 at 22:02:44 UTC, bachmeier wrote:


I can recommend D Cookbook
https://www.packtpub.com/application-development/d-cookbook

and Learning D
https://www.packtpub.com/application-development/learning-d


Publish dates are 2014 and 2015. How much the language has 
changed/evolved since then and how much it will evolve in future 
? So are these books relevant today and still next two years ?


They are rather different books, but both are well written, and 
they go into reasonable depth on the topics they cover, unlike 
a lot of programming books I've read.


Sounds great ! I might bought these too if they are still 
relevant.


Re: Doubt about this book: The D Programming Language

2018-12-16 Thread Mike Parker via Digitalmars-d-learn

On Monday, 17 December 2018 at 06:08:58 UTC, Jani Hur wrote:



Publish dates are 2014 and 2015. How much the language has 
changed/evolved since then and how much it will evolve in 
future ? So are these books relevant today and still next two 
years ?


There haven't been any changes in the language significant enough 
to make either book irrelevant, nor will there be for a while. 
And the authors of both books hang out on the forums if you find 
any inaccuracies you'd like to ask about.


Re: Doubt about this book: The D Programming Language

2018-12-17 Thread Adam D. Ruppe via Digitalmars-d-learn

On Monday, 17 December 2018 at 06:08:58 UTC, Jani Hur wrote:
Publish dates are 2014 and 2015. How much the language has 
changed/evolved since then and how much it will evolve in 
future ?


There's a few minor changes in mine (the D Cookbook one), and a 
few typos in the book I didn't catch until too late that mean 
some examples won't literally compile anyway, but they are all 
quite small.


I also tried to keep the examples straightforward, but the text 
talking about the process and thoughts behind it, so you can 
adapt that to your own purposes and that is fairly timeless. Just 
some of the stuff in there is a little bit easier now than it was 
when I wrote it, but knowing the building blocks is still useful 
and hasn't changed much.


Re: Doubt about this book: The D Programming Language

2018-12-17 Thread Mike Parker via Digitalmars-d-learn

On Sunday, 16 December 2018 at 22:02:44 UTC, bachmeier wrote:



Sometimes Packt has sales and you can get them pretty cheap.


All Packt ebooks are on sale for $5 right now, so this is a great 
time to pick up both books along with Kai's Vibe.d book.




Re: Doubt about this book: The D Programming Language

2018-12-17 Thread Ron Tarrant via Digitalmars-d-learn

On Monday, 17 December 2018 at 15:32:37 UTC, Adam D. Ruppe wrote:

There's a few minor changes in mine (the D Cookbook one), and a 
few typos in the book I didn't catch until too late that mean 
some examples won't literally compile anyway, but they are all 
quite small.


Are these typos obvious, or is there an errata?

I bought the PDF version, so maybe it's been revised?


Re: Doubt about this book: The D Programming Language

2018-12-17 Thread H. S. Teoh via Digitalmars-d-learn
On Tue, Dec 18, 2018 at 12:36:12AM +, Ron Tarrant via Digitalmars-d-learn 
wrote:
> On Monday, 17 December 2018 at 15:32:37 UTC, Adam D. Ruppe wrote:
> 
> > There's a few minor changes in mine (the D Cookbook one), and a few
> > typos in the book I didn't catch until too late that mean some
> > examples won't literally compile anyway, but they are all quite
> > small.
> 
> Are these typos obvious, or is there an errata?
[...]

http://erdani.com/tdpl/errata/


T

-- 
Meat: euphemism for dead animal. -- Flora


Re: Doubt about this book: The D Programming Language

2018-12-17 Thread Adam D Ruppe via Digitalmars-d-learn

On Tuesday, 18 December 2018 at 00:36:12 UTC, Ron Tarrant wrote:

Are these typos obvious, or is there an errata?


They're obvious. Stuff like doubled ; at the end of lines in code 
samples, or curly quotes when they should be straight. (They are 
the result of me fighting Microsoft Word and the review process 
with the publisher.)


A few other things have changed, like near the end, there is a 
sample of my terminal library and back then it was `import 
terminal;`. Now it is `import arsd.terminal;` if you use the 
newer version of the library. But the rest still works.


Re: Doubt about this book: The D Programming Language

2018-12-18 Thread Ron Tarrant via Digitalmars-d-learn

On Tuesday, 18 December 2018 at 01:16:54 UTC, Adam D Ruppe wrote:

They're obvious. Stuff like doubled ; at the end of lines in 
code samples, or curly quotes when they should be straight. 
(They are the result of me fighting Microsoft Word and the 
review process with the publisher.)


A few other things have changed, like near the end, there is a 
sample of my terminal library and back then it was `import 
terminal;`. Now it is `import arsd.terminal;` if you use the 
newer version of the library. But the rest still works.


Thanks, Adam.

And I know what you mean about fighting MS Word. It's like trying 
to do a jigsaw puzzle while the cat keeps batting pieces onto the 
floor. Invariably, you're gonna end up diving for a piece and 
banging your head on the table.


Re: Doubt about this book: The D Programming Language

2018-12-19 Thread XavierAP via Digitalmars-d-learn

On Sunday, 16 December 2018 at 18:37:15 UTC, Marko wrote:
On Amazon The D Programming Language has good reviews but it's 
8 years old. So is this book still relevant today?


Yes, I would recommend it. It is meant to be comprehensive but 
introductory, so many language or library changes since are out 
of the scope anyway. It's then also quite different from a 
cookbook approach for example -- depends what you're looking for. 
You may perhaps compare it more closely with Ali's book, but 
unfortunately I haven't read this one.


Re: Doubt about this book: The D Programming Language

2018-12-20 Thread MachineCode via Digitalmars-d-learn
On Sunday, 16 December 2018 at 19:57:08 UTC, Steven Schveighoffer 
wrote:

On 12/16/18 1:37 PM, Marko wrote:
On Amazon The D Programming Language has good reviews but it's 
8 years old. So is this book still relevant today?


Mostly, yes. And it's a pretty good book, even if it has some 
outdated parts. There's errata somewhere too.




Would you recommend another book?


I highly recommend this book (available online for free or you 
can purchase a hard copy): http://ddili.org/ders/d.en/index.html


It is continually updated by Ali, so it should be up to date 
with the latest compiler.




PS: I am already a programmer writing mainly in C and C#.


I hope you feel right at home here :) But I must warn you, if 
you're anything like me, you will hate having to go back to 
another language.


-Steve


Too bad when I need to go back to C# and/or C++ for a while. haha


Re: Programming in D vs The D Programming Language

2016-03-13 Thread _d0s_ via Digitalmars-d-learn

On Sunday, 13 March 2016 at 16:27:07 UTC, gour wrote:

Hello,

after quite some time I'm returning to D being fed up with some 
other languages to become more ready for writing open-source 
multi-platform desktop app(s)...


I already own copy of Andrei's The D Programming Language book, 
but never went fully through it, but I see in the meantime 
Programming in D by Ali was released so I wonder:


a) how much is Andrei's book still relevant?

b) whether PiD is recommended one to start with D *today* ?

Btw, I prefer hardcopy books, if possible, and interested 
whether there is plan to release PiD with hardcover since 
several reviewers @Amazon reported that the glued used to bind 
the book is not the best*



Sincerely,
Gour


b) i prefer this one :)
http://ddili.org/ders/d.en/


Re: Programming in D vs The D Programming Language

2016-03-13 Thread Ali Çehreli via Digitalmars-d-learn

On 03/13/2016 09:27 AM, gour wrote:

> a) how much is Andrei's book still relevant?

You may find that D has changed since TDPL was printed but it's still a 
great read. In some places it explains tradeoffs in language design in 
general.


> b) whether PiD is recommended one to start with D *today* ?

PiD starts as a tutorial to novices but can also be used a D language 
(not Phobos) reference because it includes virtually everything. (There 
are exceptions e.g. __ctor and friends are not mentioned at all.)


Best thing for you to do is to check out PiD first before deciding to 
buy. The PDF file is exactly the same as the printed version:


  http://ddili.org/ders/d.en/

> plan to release PiD with hardcover

There is a hardcover edition:

  978-0-692-59943-3

> since several reviewers @Amazon reported that the glued used to
> bind the book is not the best*

I found the quality of the softcover by CreateSpace pretty good in 
general but there was one copy that was trimmed unacceptable crooked. 
However, I've never seen one with a bad glue. I think this is due to 
different regional printers: Perhaps the printers that shipped to my 
address (Bay Area, California) were better. (?)


On the other hand, the hardcover edition that I have has a different 
kind of binding issue: The long rectangular spine piece is too narrow. 
(I've heard this from a reader as well.) I presume the paper used by the 
printer has gotten thicker over time, presumably still within spec, but 
the template that they give to the cover designer is still for thinner 
paper. (?) The end result is a book that doesn't fit inside that narrow 
spine piece well. :-/


I've gone all the trouble to also publish with IngramSpark and gave the 
book stores a very big discount just so that users could return their 
books. How about order your copy through your local book store and see 
how it looks and whether the return process is pleasant. (If not, I'll 
buy you dinner in Berlin at DConf. ;) )


Ali



Re: Programming in D vs The D Programming Language

2016-03-13 Thread Saša Janiška via Digitalmars-d-learn
Ali Çehreli  writes:

> You may find that D has changed since TDPL was printed but it's still
> a great read. In some places it explains tradeoffs in language design
> in general.

Yeah, I like, based on what I've seen some portions which explains
'why'.

> PiD starts as a tutorial to novices but can also be used a D language
> (not Phobos) reference because it includes virtually everything.

Great!

> I found the quality of the softcover by CreateSpace pretty good in
> general but there was one copy that was trimmed unacceptable crooked.
> However, I've never seen one with a bad glue.

Have you seen this one:

http://www.amazon.com/gp/customer-reviews/R1WWT9EIV3UDI0/ref=cm_cr_arp_d_rvw_ttl?ie=UTF8&ASIN=0692599436

> On the other hand, the hardcover edition that I have has a different
> kind of binding issue: The long rectangular spine piece is too narrow.

Hmm...that's strange as well...

> I presume the paper used by the printer has gotten thicker over time,
> presumably still within spec, but the template that they give to the
> cover designer is still for thinner paper. (?) The end result is a
> book that doesn't fit inside that narrow spine piece well. :-/

I was publishing hardcover books so I know what are you talking about.

Otoh, if I'd put paperback in hardcover at some local shop. it would
cost me additional $10  - almost the price difference, but I might think
about it since the end result might be better. (btw, I also put Andrei's
book in hardcover and the end result is superb.)

> I've gone all the trouble to also publish with IngramSpark and gave
> the book stores a very big discount just so that users could return
> their books. How about order your copy through your local book store
> and see how it looks and whether the return process is pleasant.

Well, I'm from Croatia and the D is too unpopular here, so there is no
way to find the book in the local store.

Anyway, thank you for additional info about book production and its
quality, so I can have proper decision what to buy.

(If not, I'll buy you dinner in Berlin at DConf. ;) )

Thank you for an invitation - I'm not sure I'll make it, but, at least,
I'm happy to be back to D and your book is one of the reasons. ;)


Sincerely,
Gour

-- 
>From wherever the mind wanders due to its flickering and unsteady
nature, one must certainly withdraw it and bring it back under
the control of the self.


Re: Programming in D vs The D Programming Language

2016-03-13 Thread Ali Çehreli via Digitalmars-d-learn

On 03/13/2016 02:40 PM, Saša Janiška wrote:

>> quality of the softcover by CreateSpace

> Have you seen this one:
>
> 
http://www.amazon.com/gp/customer-reviews/R1WWT9EIV3UDI0/ref=cm_cr_arp_d_rvw_ttl?ie=UTF8&ASIN=0692599436


Yes, I had seen that one. It is unfortunate... :-/

>> I've gone all the trouble to also publish with IngramSpark and gave
>> the book stores a very big discount just so that users could return
>> their books. How about order your copy through your local book store
>> and see how it looks and whether the return process is pleasant.
>
> Well, I'm from Croatia and the D is too unpopular here, so there is no
> way to find the book in the local store.

I agree and I doubt that I will ever see PinD on a local bookshop shelf. 
What I meant was, IngramSpark makes it *possible* at all for a local 
bookshop to order the book for you and that you can return it for a full 
refund.


The differences are:

* Because they boycot CreateSpace due to its affiliation with Amazon, a 
local bookstore will not store books printed by CreateSpace. This is 
because the wholesale discount is too little from CreateSpace and local 
book stores do not agree with certain practices of Amazon's book business.


* They will still order for you a book by CreateSpace only if you pay up 
front and if you understand that the book is not returnable. (Because 
CreateSpace books are simply not returnable.) On the other hand, if the 
local book store orders the book from IngramSpark, then you need not 
prepay and you (and the bookstore) can return it.


So, I really think that your local bookstore will order one of the 
IngramSpark printing. And you will not pay for customs or shipping.


>> dinner in Berlin at DConf. ;) )
>
> Thank you for an invitation - I'm not sure I'll make it

11 hours by car to Berlin seems a little long for you but there must be 
trains in Europe. ;) I hope you and many others can make it. So many 
good friends here...


Ali



Re: Programming in D vs The D Programming Language

2016-03-14 Thread Saša Janiška via Digitalmars-d-learn
Ali Çehreli  writes:

> I agree and I doubt that I will ever see PinD on a local bookshop
> shelf. What I meant was, IngramSpark makes it *possible* at all for a
> local bookshop to order the book for you and that you can return it
> for a full refund.

Now I'm living in much smaller place and will ask about the possibilities
to order, although I remember when I was living in the capital (Zagreb),
ordering from the shop ended up as double expensive in comparison with
e.g. Amazon order.

> * Because they boycot CreateSpace due to its affiliation with Amazon,
> a local bookstore will not store books printed by CreateSpace. This is
> because the wholesale discount is too little from CreateSpace and
> local book stores do not agree with certain practices of Amazon's book
> business.

I'm also not excited with the their business behaviour, but, otoh, do
not have much choices except using some other online retailer.

> * They will still order for you a book by CreateSpace only if you pay
> up front and if you understand that the book is not returnable.
> (Because CreateSpace books are simply not returnable.)

Ahh, I se..

> On the other hand, if the local book store orders the book from
> IngramSpark, then you need not prepay and you (and the bookstore) can
> return it.

I'm just curious if the above applies here. ;)

> So, I really think that your local bookstore will order one of the
> IngramSpark printing. And you will not pay for customs or shipping.

It sounds good, although I'm taking it with pinch of salt until I check
it out.

> 11 hours by car to Berlin seems a little long for you but there must
> be trains in Europe. ;)

There are nice trains in Europe, but poor connections in Croatia.

> I hope you and many others can make it. So many good friends here...

There are other circumstances to overcome (taking care of our small
daughter, while wife is working at emergency and you might heard there
is lack of doctors here and they have to work extra hours etc.)

However, let me thank you for the book which I know, from personal
epxerience, is always a labour of love and cannot be properly paid back,
but, at least, be happy that it created one new (old) user. ;)


Sincerely,
Gour

p.s. I'll inform you about my decision from where to get the book.

-- 
Bewildered by the modes of material nature, the ignorant fully
engage themselves in material activities and become attached. But
the wise should not unsettle them, although these duties are inferior
due to the performers' lack of knowledge.


Andrei's "The D Programming Language" book. Up to date?

2017-10-04 Thread John Gabriele via Digitalmars-d-learn

Hi all,

This is my first message to this forum. And what a pleasure it is 
to be here. :)


I was just looking around at what D books are available. I see 
that Andrei's "The D Programming Language" was published in 2010. 
What's changed in the language, library, and community since then 
that I should be aware of if following along with and learning 
from that book?


Incidentally, is a new edition is on its way any time soon?

Thanks!



Re: Does D programming language have work steal queue?

2022-05-22 Thread zoujiaqing via Digitalmars-d-learn

On Sunday, 22 May 2022 at 21:07:19 UTC, zoujiaqing wrote:

Does D language have task steal queue?
The requirements are high-performance, lock-free, and 
thread-safe.


I think the final usage scenario is similar to this C++ project:
https://github.com/ConorWilliams/Forkpool


Re: Does D programming language have work steal queue?

2022-05-22 Thread zoujiaqing via Digitalmars-d-learn

On Sunday, 22 May 2022 at 21:23:24 UTC, zoujiaqing wrote:

On Sunday, 22 May 2022 at 21:07:19 UTC, zoujiaqing wrote:

Does D language have task steal queue?
The requirements are high-performance, lock-free, and 
thread-safe.


I think the final usage scenario is similar to this C++ project:
https://github.com/ConorWilliams/Forkpool


This project implements many of the ideas in (available in 
reference/):


 * F. Schmaus et al., “Nowa: A Wait-Free Continuation-Stealing 
Concurrency Platform”. In: 2021 IEEE International Parallel and 
Distributed Processing Symposium (IPDPS). 2021.
 * C. -X. Lin, T. -W. Huang and M. D. F. Wong, "An Efficient 
Work-Stealing Scheduler for Task Dependency Graph," 2020 IEEE 
26th International Conference on Parallel and Distributed Systems 
(ICPADS), 2020, pp. 64-71, doi: 10.1109/ICPADS51040.2020.00018.




Re: Does D programming language have work steal queue?

2022-05-22 Thread Stefan Koch via Digitalmars-d-learn

On Sunday, 22 May 2022 at 21:07:19 UTC, zoujiaqing wrote:

Does D language have task steal queue?
The requirements are high-performance, lock-free, and 
thread-safe.


I have one called fluffy:
https://github.com/UplinkCoder/fluffy

I am not 100% sure about the performance I did try to make it 
reasonable but in the absence of anything else it might be 
jumping off point for you.


Re: Does D programming language have work steal queue?

2022-05-22 Thread mw via Digitalmars-d-learn

On Sunday, 22 May 2022 at 21:07:19 UTC, zoujiaqing wrote:

Does D language have task steal queue?
The requirements are high-performance, lock-free, and 
thread-safe.


I have a C's liblfds D wrapper:

https://github.com/mw66/liblfdsd

right now only bmm and bss queue are wrapped.

It's not in dub yet, but I have been using it for a while, feel 
free to give it a try, or even send PRs :-)


Re: Does D programming language have work steal queue?

2022-05-22 Thread mw via Digitalmars-d-learn

On Sunday, 22 May 2022 at 22:37:43 UTC, Stefan Koch wrote:

On Sunday, 22 May 2022 at 21:07:19 UTC, zoujiaqing wrote:

Does D language have task steal queue?
The requirements are high-performance, lock-free, and 
thread-safe.


I have one called fluffy:
https://github.com/UplinkCoder/fluffy




The git link 404?

I am not 100% sure about the performance I did try to make it 
reasonable but in the absence of anything else it might be 
jumping off point for you.





Re: Does D programming language have work steal queue?

2022-05-22 Thread Stefan Koch via Digitalmars-d-learn

On Sunday, 22 May 2022 at 23:35:11 UTC, mw wrote:

On Sunday, 22 May 2022 at 22:37:43 UTC, Stefan Koch wrote:

On Sunday, 22 May 2022 at 21:07:19 UTC, zoujiaqing wrote:

Does D language have task steal queue?
The requirements are high-performance, lock-free, and 
thread-safe.


I have one called fluffy:
https://github.com/UplinkCoder/fluffy




The git link 404?

I am not 100% sure about the performance I did try to make it 
reasonable but in the absence of anything else it might be 
jumping off point for you.


Looks like I had the repo set to private.
It should work now.


Re: Does D programming language have work steal queue?

2022-05-23 Thread zoujiaqing via Digitalmars-d-learn

On Sunday, 22 May 2022 at 23:34:19 UTC, mw wrote:

On Sunday, 22 May 2022 at 21:07:19 UTC, zoujiaqing wrote:

Does D language have task steal queue?
The requirements are high-performance, lock-free, and 
thread-safe.


I have a C's liblfds D wrapper:

https://github.com/mw66/liblfdsd

right now only bmm and bss queue are wrapped.

It's not in dub yet, but I have been using it for a while, feel 
free to give it a try, or even send PRs :-)


Thanks :)
I will try it.


Re: Does D programming language have work steal queue?

2022-05-23 Thread zoujiaqing via Digitalmars-d-learn

On Sunday, 22 May 2022 at 22:37:43 UTC, Stefan Koch wrote:

On Sunday, 22 May 2022 at 21:07:19 UTC, zoujiaqing wrote:

Does D language have task steal queue?
The requirements are high-performance, lock-free, and 
thread-safe.


I have one called fluffy:
https://github.com/UplinkCoder/fluffy

I am not 100% sure about the performance I did try to make it 
reasonable but in the absence of anything else it might be 
jumping off point for you.


Thanks ;)


Re: Does D programming language have work steal queue?

2022-05-23 Thread mw via Digitalmars-d-learn

On Monday, 23 May 2022 at 23:07:00 UTC, zoujiaqing wrote:

On Sunday, 22 May 2022 at 23:34:19 UTC, mw wrote:

On Sunday, 22 May 2022 at 21:07:19 UTC, zoujiaqing wrote:

Does D language have task steal queue?
The requirements are high-performance, lock-free, and 
thread-safe.


I have a C's liblfds D wrapper:

https://github.com/mw66/liblfdsd

right now only bmm and bss queue are wrapped.

It's not in dub yet, but I have been using it for a while, 
feel free to give it a try, or even send PRs :-)



BTW, some very simple performance comparison with other D queues 
are here:


https://github.com/mw66/liblfdsd/tree/master/comparison


Re: Does D programming language have work steal queue?

2022-06-05 Thread mw via Digitalmars-d-learn

I will try it.


It's in dub now:

https://code.dlang.org/packages/liblfdsd


Also added queue_umm: unbounded,manyproducer,many_consumer, 
lock-free queue






Re: Andrei's "The D Programming Language" book. Up to date?

2017-10-04 Thread Ali Çehreli via Digitalmars-d-learn
Andrei's book contains some outdated and some not-yet-implemented things 
but it's still a great read. It explains core features and design 
decisions of D very well.


Ali



Re: Andrei's "The D Programming Language" book. Up to date?

2017-10-05 Thread Dukc via Digitalmars-d-learn

On Wednesday, 4 October 2017 at 20:49:26 UTC, John Gabriele wrote:

Hi all,

This is my first message to this forum. And what a pleasure it 
is to be here. :)


I was just looking around at what D books are available. I see 
that Andrei's "The D Programming Language" was published in 
2010. What's changed in the language, library, and community 
since then that I should be aware of if following along with 
and learning from that book?


Incidentally, is a new edition is on its way any time soon?

Thanks!


The core language hasn't changed that much (yet some). Most of 
the differences from times back then are because we now have much 
more third-party libraries, and the implementation is much more 
stable. Or that's what I've heard anyway.


And I think that the book is ahead of it's time, advertising 
features that probably only barely worked and were seldom used 
back then. Just what Modern c++ is known for too. That makes it 
feel easily three years younger than it really is. I wasn't here 
myself trough so I don't know for sure.


Re: Andrei's "The D Programming Language" book. Up to date?

2017-10-05 Thread Seb via Digitalmars-d-learn

On Wednesday, 4 October 2017 at 20:49:26 UTC, John Gabriele wrote:

Hi all,

This is my first message to this forum. And what a pleasure it 
is to be here. :)


I was just looking around at what D books are available. I see 
that Andrei's "The D Programming Language" was published in 
2010. What's changed in the language, library, and community 
since then that I should be aware of if following along with 
and learning from that book?


Incidentally, is a new edition is on its way any time soon?

Thanks!


I can only recommend his book. You get a "second-hand" insight 
into all decisions of D2 and Andrei's writing style is very 
vivid, so one can barely stop reading the book.


In case you are interested on the list of things that have 
changed, there's http://erdani.com/tdpl/errata (it's mostly just 
typos though).


Re: Andrei's "The D Programming Language" book. Up to date?

2017-11-29 Thread Nick Treleaven via Digitalmars-d-learn

On Wednesday, 4 October 2017 at 20:49:26 UTC, John Gabriele wrote:
What's changed in the language, library, and community since 
then that I should be aware of if following along with and 
learning from that book?


Here's a list of significant things - maybe incomplete:
https://wiki.dlang.org/Differences_With_TDPL


Re: Andrei's "The D Programming Language" book. Up to date?

2017-11-29 Thread Arun Chandrasekaran via Digitalmars-d-learn
On Wednesday, 29 November 2017 at 17:26:11 UTC, Nick Treleaven 
wrote:

Here's a list of significant things - maybe incomplete:
https://wiki.dlang.org/Differences_With_TDPL



Multiple alias this
You can only have one subtyping member currently.



Shared
Not all of shared's guarantees are implemented yet.



SafeD
@safe (and therefore SafeD) isn't fully implemented. So, it 
doesn't necessarily work quite like it's supposed to yet.


How much of these are relevant today with 2.077.0?


Re: Andrei's "The D Programming Language" book. Up to date?

2017-11-29 Thread Nick Treleaven via Digitalmars-d-learn
On Wednesday, 29 November 2017 at 17:50:59 UTC, Arun 
Chandrasekaran wrote:

Multiple alias this
You can only have one subtyping member currently.



Shared
Not all of shared's guarantees are implemented yet.



SafeD
@safe (and therefore SafeD) isn't fully implemented. So, it 
doesn't necessarily work quite like it's supposed to yet.


How much of these are relevant today with 2.077.0?


The first two are true AIUI. @safe is mostly implemented, there's 
been a lot of progress on that since TDPL.


Re: Andrei's "The D Programming Language" book. Up to date?

2017-11-29 Thread John Gabriele via Digitalmars-d-learn
On Wednesday, 29 November 2017 at 17:26:11 UTC, Nick Treleaven 
wrote:
On Wednesday, 4 October 2017 at 20:49:26 UTC, John Gabriele 
wrote:
What's changed in the language, library, and community since 
then that I should be aware of if following along with and 
learning from that book?


Here's a list of significant things - maybe incomplete:
https://wiki.dlang.org/Differences_With_TDPL


Nice! Thanks, Nick!



Re: Andrei's "The D Programming Language" book. Up to date?

2017-11-29 Thread Jonathan M Davis via Digitalmars-d-learn
On Wednesday, November 29, 2017 17:26:11 Nick Treleaven via Digitalmars-d-
learn wrote:
> On Wednesday, 4 October 2017 at 20:49:26 UTC, John Gabriele wrote:
> > What's changed in the language, library, and community since
> > then that I should be aware of if following along with and
> > learning from that book?
>
> Here's a list of significant things - maybe incomplete:
> https://wiki.dlang.org/Differences_With_TDPL

I didn't even realize that that page existed. I just made some tweaks to it,
though it's still probably far from complete as far as stuff not mentioned
in TDPL goes. As for unimplemented stuff, it made it sound like shared isn't
implemented (which isn't true at all; it just doesn't have memory barriers
like TDPL talks about; the big thing missing for shared is arguably that the
memory model for D needs to be properly defined like C++ finally did, but
TDPL doesn't talk about that at all), and the wiki page didn't list
synchronized classes, which is the other big one that isn't implemented
(though putting synchronized on classes actually has _some_ effect now,
which it didn't until fairly recently).

- Jonathan M Davis



Trying to compile sample from The D Programming Language book.

2011-04-03 Thread Junior
Hello, I am completely stuck on this error, any help would be appreciated...
google was not helpful (too many useless matches for "D ").

I am trying to compile this:

import std.string, std.algorithm, std.conv, std.ctype, std.regex, std.range,
std.stdio;
// blah blah blah
auto words = split(sentence, regex("[ \t,.;:?]+"));
// blah blah blah


and two compilers (gdc, dmd) are giving me this error (output from gdc):

main.d:34: Error: std.string.split at
/usr/lib/gcc/x86_64-unknown-linux-gnu/4.5.1/../../../../include/d2/4.5.1/std/string.d:69
conflicts with std.regex.split(String) at
/usr/lib/gcc/x86_64-unknown-linux-gnu/4.5.1/../../../../include/d2/4.5.1/std/regex.d:3096


And I am clueless. How can they conflict, it's the standard library. It must
be in the usage of split. As this is the second or third example in chapter
one, I have no clue what is going on.

Thanks!


Re: Trying to compile sample from The D Programming Language book.

2011-04-03 Thread Jesus Alvarez
I got it to compile adding std.regex to split to make it:

auto words = std.regex.split (sentence, regex("[ \t,.;:?]+"));

So now my question is, is this an error in the book? The errata doesn't
mention anything about this section. Why do I have to prepend std.regex?

Thanks!


Re: Trying to compile sample from The D Programming Language book.

2011-04-03 Thread Jonathan M Davis
On 2011-04-03 00:10, Junior wrote:
> Hello, I am completely stuck on this error, any help would be
> appreciated... google was not helpful (too many useless matches for "D
> ").
> 
> I am trying to compile this:
> 
> import std.string, std.algorithm, std.conv, std.ctype, std.regex,
> std.range, std.stdio;
> // blah blah blah
> auto words = split(sentence, regex("[ \t,.;:?]+"));
> // blah blah blah
> 
> 
> and two compilers (gdc, dmd) are giving me this error (output from gdc):
> 
> main.d:34: Error: std.string.split at
> /usr/lib/gcc/x86_64-unknown-linux-gnu/4.5.1/../../../../include/d2/4.5.1/st
> d/string.d:69 conflicts with std.regex.split(String) at
> /usr/lib/gcc/x86_64-unknown-linux-gnu/4.5.1/../../../../include/d2/4.5.1/st
> d/regex.d:3096
> 
> 
> And I am clueless. How can they conflict, it's the standard library. It
> must be in the usage of split. As this is the second or third example in
> chapter one, I have no clue what is going on.

If both regex and string have a split function and the compiler can't tell 
which one you mean, then you're going to have to tell the compiler which split 
you mean, because there's an ambiguity. So, assuming that the split that you 
mean is the one in std.string, then you'd do

auto words = std.string.split(sentence, regex("[ \t,.;:?]+"));

Another option would be to use an alias such as

alias std.string.split split;

so that the whole module assumes that split is the one from std.string. Also, 
while for the most part, dmd follows TDPL, in some cases, TDPL is ahead and 
dmd hasn't implemented certain things yet. In addition, as far as the standard 
library goes, TDPL is not trying to really introduce or explain it for the 
most part, and in some cases, the standard library may have changed somewhat 
(though generally not drastically) from what's in the book. So, while _most_ 
examples will compile, some won't.

You should check out the errata page here: 
http://erdani.com/tdpl/errata/index.php?title=Main_Page

It also gives you the code for all of the examples as well as telling you 
which should currently work.

- Jonathan M Davis


Re: Trying to compile sample from The D Programming Language book.

2011-04-03 Thread spir

On 04/03/2011 09:38 AM, Jesus Alvarez wrote:

I got it to compile adding std.regex to split to make it:

auto words = std.regex.split (sentence, regex("[ \t,.;:?]+"));

So now my question is, is this an error in the book? The errata doesn't
mention anything about this section.


If the TDPL code does not prefix split then, yes, it is an error. (In fact, 
there was maybe no regex split at the time it was written.) You may add it at 
the errata page mentionned by Jonathan.



 Why do I have to prepend std.regex?


How can the compiler guess you mean std.regex.split; and not std.string.split, 
if you don't tell it?


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



Re: Trying to compile sample from The D Programming Language book.

2011-04-04 Thread Jesus Alvarez
I reported the error to the author. Thanks guys!

On Sun, Apr 3, 2011 at 3:34 AM, spir  wrote:

> On 04/03/2011 09:38 AM, Jesus Alvarez wrote:
>
>> I got it to compile adding std.regex to split to make it:
>>
>> auto words = std.regex.split (sentence, regex("[ \t,.;:?]+"));
>>
>> So now my question is, is this an error in the book? The errata doesn't
>> mention anything about this section.
>>
>
> If the TDPL code does not prefix split then, yes, it is an error. (In fact,
> there was maybe no regex split at the time it was written.) You may add it
> at the errata page mentionned by Jonathan.
>
>
>   Why do I have to prepend std.regex?
>>
>
> How can the compiler guess you mean std.regex.split; and not
> std.string.split, if you don't tell it?
>
> Denis
> --
> _
> vita es estrany
> spir.wikidot.com
>
>


How to print or check if a string is "\0" (null) terminated in the D programming language?

2022-04-06 Thread BoQsc via Digitalmars-d-learn
I have a feeling that some parts of my code contains unterminated 
strings and they do overflow into other string that is to be 
combined. I'd like to take a look at strings, analyse them 
manually and see if any of them end up terminated or not.


Please provide any relevant examples of how you do this.



Re: How to print or check if a string is "\0" (null) terminated in the D programming language?

2022-04-06 Thread Andrea Fontana via Digitalmars-d-learn

On Wednesday, 6 April 2022 at 08:55:43 UTC, BoQsc wrote:
I have a feeling that some parts of my code contains 
unterminated strings and they do overflow into other string 
that is to be combined. I'd like to take a look at strings, 
analyse them manually and see if any of them end up terminated 
or not.


Please provide any relevant examples of how you do this.


string literals are zero-terminated in d.

If you need to pass a D string to a C function use toStringz()
https://dlang.org/library/std/string/to_stringz.html




Re: How to print or check if a string is "\0" (null) terminated in the D programming language?

2022-04-06 Thread Stanislav Blinov via Digitalmars-d-learn

On Wednesday, 6 April 2022 at 08:55:43 UTC, BoQsc wrote:
I have a feeling that some parts of my code contains 
unterminated strings and they do overflow into other string 
that is to be combined. I'd like to take a look at strings, 
analyse them manually and see if any of them end up terminated 
or not.


Please provide any relevant examples of how you do this.


In general, you shouldn't do that. In D, a `string`, `wstring` 
and `dstring` are slices of corresponding character types, and 
are *not* null-terminated (and in fact can contain 0 within their 
representation). However, as Andrea Fontana points out, string 
literals are null-terminated (but note that the terminator itself 
isn't included in a `string` initialized with such a literal), 
and also convert to pointers - these two properties allow using 
them as arguments to C functions.


Thus, since null terminator isn't normally included as part of a 
string, you'd have to read past array bounds to check if there's 
a 0 there, and doing so leads to undefined behavior.


In fact, you should simply assume that any D string you encounter 
is not null-terminated. And if you want to ensure you're always 
passing around null-terminated strings, you should either use the 
greedy allocating functions such as `toStringz`, or perhaps make 
your own type that always allocates extra space for a 0.


Re: How to print or check if a string is "\0" (null) terminated in the D programming language?

2022-04-06 Thread Salih Dincer via Digitalmars-d-learn

On Wednesday, 6 April 2022 at 08:55:43 UTC, BoQsc wrote:
I have a feeling that some parts of my code contains 
unterminated strings and they do overflow into other string 
[...]


If you suspect overflow, you can try string wrapping.