Re: Coding style on dlang.org

On Saturday, 23 August 2014 at 14:52:45 UTC, H. S. Teoh via 
Digitalmars-d wrote:
> I notice that the coding style used for code examples on 
> dlang.org isn't
> always consistent, and they generally differ from Phobos 
> examples.
> Should we adopt Phobos style for all code examples on dlang.org?
>
>
> T

Do you have any specific examples? I'd assume the code is mostly 
old. I'd reject any pull that doesn't adhere to Phobos style, 
even if it's just ddoc'ed examples.

Coding style on dlang.org

I notice that the coding style used for code examples on dlang.org isn't
always consistent, and they generally differ from Phobos examples.
Should we adopt Phobos style for all code examples on dlang.org?

T

--

-- 
Real Programmers use "cat > a.out".

DUB fails with 2.067 MinType

https://github.com/D-Programming-Language/dub/issues/402

Output is very sparse:

DMD64 D Compiler v2.067-devel-1a10637

/opt/dmd/include/d2/std/algorithm.d(7168): Error: template 
instance std.algorithm.MinType!(uint, uint) recursive expansion

Clues anyone?

Re: Unused variables and bugs

On Saturday, 23 August 2014 at 04:07:58 UTC, ketmar via 
Digitalmars-d wrote:
> On Sat, 23 Aug 2014 03:50:13 +0000
> via Digitalmars-d <digitalmars-d <at> puremagic.com> wrote:
>
>> - versioning
> refactor it, so that shared code goes to separate functions. 
> nested
> functions especially helpful here. i'm used to this GCC 
> extension.

Won't work. Different versions might need extra parameters, but 
you want the same interface. Like one version might need manual 
calibration.

>> - debugging (commenting out debugging code)
> why comment it out? if (debug_enabled) is fine and can help when
> software fails.

To avoid visual clutter. To be able to span syntactical 
boundaries. To take advantage of hiding in editors.

>> - virtual functions
> they are either abstract or just comment out unused argument 
> names.

No, unused in superclasses, used in subclasses.

>> - future-proof function signatures
> but why? plan your API. if you need to extend it -- add new API 
(Continue reading)

via Digitalmars-d | 23 Aug 05:50 2014

Re: Unused variables and bugs

On Saturday, 23 August 2014 at 02:48:15 UTC, ketmar via
Digitalmars-d wrote:
> don't declare unused variables. really, this is extremely easy. 
> my 15+
> years of expirience in writing projects of different scale

What about:

- versioning
- debugging (commenting out debugging code)
- virtual functions
- future-proof function signatures

Of course the common way to deal with it in C is to tell the
compiler that it is intentional by casting to void:

(void) argc;
(void) argv;

Re: RFC: std.json sucessor

Am 22.08.2014 21:15, schrieb Andrej Mitrovic via Digitalmars-d:
> On 8/22/14, Sönke Ludwig <digitalmars-d <at> puremagic.com> wrote:
>> Docs: http://s-ludwig.github.io/std_data_json/
>
> This confused me for a solid minute:
>
> // Lex a JSON string into a lazy range of tokens
> auto tokens = lexJSON(`{"name": "Peter", "age": 42}`);
>
> with (JSONToken.Kind) {
>      assert(tokens.map!(t => t.kind).equal(
>          [objectStart, string, colon, string, comma,
>          string, colon, number, objectEnd]));
> }
>
> Generally I'd avoid using de-facto reserved names as enum member names
> (e.g. string).
>

Hmmm, but it *is* a string. Isn't the problem more the use of with in 
this case? Maybe the example should just use with(JSONToken) and then 
Kind.string?

Re: Windows service in D

Ten years is a long time but perhaps this can help anyone running 
into this forum thread.

https://github.com/duovia/WindowsServiceInD

I'm using the Windows API library (source actually) on 
dsource.org. See link on the github page. I found it difficult to 
find a complete solution to the problem, so I'm going to cross 
post in a few places to make it easier to find for others seeking 
an answer to the same question.

On Wednesday, 9 June 2004 at 21:18:45 UTC, Walter wrote:
> If probably means you need to link in the .obj for the module 
> where
> SERVICE_TABLE_ENTRY is defined.
>
> "Gifford Hesketh" <gifford.hesketh <at> savvis.net> wrote in message
> news:c93ciu$lk8$1 <at> digitaldaemon.com...
>> A few months ago, I asked if anyone had an example of a 
>> Windows service
>> written in D.  Not finding one, I wrote one -- although there 
>> was one
>> outstanding issue I wanted to resolve before making it public.
>>
>> Looking at this again, D's tools changes seem to have broken 
>> the
>> compilation.  Before I make anyone wade through my code, does 
>> an error
> like
>> the following look familiar to anyone ?
(Continue reading)

Unused variables and bugs

Apparently there is evidence that unused variables in C-like 
languages correlate with bugs:

https://kev.inburke.com/slides/errors/#error-correlations

One problem with ruling out some classes of unused variables 
(like unused function arguments, unused private module-level 
variables, unused function-local variables, and so on) is that 
when you are writing code you sometimes add some unused 
variables, that you usually will use or remove later.

So you usually don't want an error or warning for unused 
variables when you are writing code, but later there is a moment 
when you probably want to clean up your code and remove any 
unused variable to make the code more clean and tight.

A simple solution in C-languages is to add a compiler switch that 
allows to disallow or allow the unused variables according to the 
phase of your working on the code. But compiler switch 
proliferation can be a problem (unless you use an IDE, that 
offers you a button to enable/disable such tests).

Another solution is to leave such tests out of the core compiler, 
and put them in a lint tool that you run when you think your code 
is in good shape.

Bye,
bearophile

(Continue reading)

Re: Yet another victory for D

I got this FB chatted to me from an old programmer friend too 
yesterday who has never used D himself but knows I do. It seems 
to be getting somewhat broad exposure.

Dicebot via Digitalmars-d | 22 Aug 19:55 2014

Re: Yet another victory for D

On Friday, 22 August 2014 at 17:54:36 UTC, H. S. Teoh via 
Digitalmars-d wrote:
> A friend of mine stumbled across this today:
>
> 	http://tomerfiliba.com/blog/dlang/
>
> Rejoice! :-)
>
>
> T

http://forum.dlang.org/post/qycdbardacyhvabyqdcc <at> forum.dlang.org

Re: Yet another victory for D

On Friday, 22 August 2014 at 17:54:36 UTC, H. S. Teoh via 
Digitalmars-d wrote:
> A friend of mine stumbled across this today:
>
> 	http://tomerfiliba.com/blog/dlang/
>
> Rejoice! :-)
>
>
> T

There's a fairly active conversation going on about this article 
on Hacker News currently.

https://news.ycombinator.com/item?id=8211639


Gmane