November 09, 2017
On Thursday, 9 November 2017 at 05:07:33 UTC, Andrew Edwards wrote:
> On Thursday, 9 November 2017 at 04:58:19 UTC, Chuck Allison wrote:
>>
>> Chuck Allison
>
> Sorry to hijack this thread but it shan't be helped. Chuck, how is it going? Curious about the status of "Thinking in D". How do I go about participating in the draft review?
>
> -- Andrew

And before I forget, where do I pre-order my copy?
November 09, 2017
On Thursday, 9 November 2017 at 04:58:19 UTC, Chuck Allison wrote:
> As others have said, rename the .d file, since files are considered modules. I have since changed my notes to reflect this change. Sorry for the confusion.
>
> Chuck Allison


When coming to a new language I tend to write lots of little snippets (or copy/save examples), and then I name those snippet files according to the thing being 'snipped'. But, if you do that in D (and many will do that), and you don't have some module namespace in your snippets, you'll run it the same trouble I did.
I spent a day debugging because of this ;-)

So, can I suggest that all code samples, by default, have: module test;  (or something at the top).

I'd also recommend making this issue of module namespace, one of the *first* things people learn, when coming to D, especially that fact, that the compiler will create a namespace for you (if you don't) based on the file name.

So if you're writing a book, perhaps that should be in your mind too ;-)

btw. As I've mentioned on other posts, the current version of GDC (as opposed to DMD and LDC) will compile such code without issue (i.e when you don't give a module name), and it will correctly work out the correct namespace to use(apparently a bug - but a nice bug ;-)


1 2
Next ›   Last »