Re: observation: D getting a bit complex

2015-08-30 Thread anonymous via Digitalmars-d-learn
On Sunday 30 August 2015 04:42, Spacen Jasset wrote:

> immutable(ElementEncodingType!(ElementType!Range))[]
> buildPath(Range)(Range segments) if (isInputRange!Range &&
> isSomeString!(ElementType!Range));
> pure nothrow @safe immutable(C)[] buildPath(C)(const(C)[][]
> paths...) if (isSomeChar!C);
> 
> http://dlang.org/phobos/std_path.html

It's less horrible in the /library/ docs:


immutable(ElementEncodingType!(ElementType!Range))[] buildPath(Range)(
  Range segments
)
if (isInputRange!Range && isSomeString!(ElementType!Range));

immutable(C)[] buildPath(C)(
  const(C)[][] paths
) pure nothrow @safe
if (isSomeChar!C);


http://dlang.org/library/std/path/build_path.html

The /library/ docs are supposed to replace the current /phobos/ ones, but I 
don't know what's the latest on that.


Re: observation: D getting a bit complex

2015-08-30 Thread H. S. Teoh via Digitalmars-d-learn
On Sun, Aug 30, 2015 at 07:36:53AM +, BBasile via Digitalmars-d-learn wrote:
> On Sunday, 30 August 2015 at 02:42:30 UTC, Spacen Jasset wrote:
> >immutable(ElementEncodingType!(ElementType!Range))[]
> >buildPath(Range)(Range segments) if (isInputRange!Range &&
> >isSomeString!(ElementType!Range));
> >pure nothrow @safe immutable(C)[] buildPath(C)(const(C)[][] paths...) if
> >(isSomeChar!C);
> 
> this is stodgy, particularly in a console with line wrapping at 80
> chars.

https://issues.dlang.org/show_bug.cgi?id=13676


T

-- 
People who are more than casually interested in computers should have at least 
some idea of what the underlying hardware is like. Otherwise the programs they 
write will be pretty weird. -- D. Knuth


Re: observation: D getting a bit complex

2015-08-30 Thread bachmeier via Digitalmars-d-learn

On Sunday, 30 August 2015 at 02:42:30 UTC, Spacen Jasset wrote:
The following reminds me of the good old C++ template errors 
the C++ compiler spits out.


Whilst D has fixed that problem, some things have gotten more 
complex. I just wanted to find a replacement for D1 path join, 
and found this, but it doesn't seem very easy to wade though 
this stuff.



immutable(ElementEncodingType!(ElementType!Range))[] 
buildPath(Range)(Range segments) if (isInputRange!Range && 
isSomeString!(ElementType!Range));
pure nothrow @safe immutable(C)[] buildPath(C)(const(C)[][] 
paths...) if (isSomeChar!C);


http://dlang.org/phobos/std_path.html

It would take me a lot of time to appeciate what that all 
means, although I can imagine what it is for.


...just and observation. The complexity is building.


With C++ I rarely have trouble finding a good explanation, it's 
just a really complex language that doesn't get easier when you 
use it. For D, the documentation is a work in progress, 
amplifying the learning curve for the things that make life 
easier for experienced programmers.


The official documentation is going to have to take a better 
approach when dealing with ranges and generic programming because 
the current approach doesn't work at all.


Re: observation: D getting a bit complex

2015-08-30 Thread BBasile via Digitalmars-d-learn

On Sunday, 30 August 2015 at 10:42:24 UTC, Spacen Jasset wrote:

On Sunday, 30 August 2015 at 07:36:55 UTC, BBasile wrote:

On Sunday, 30 August 2015 at 02:42:30 UTC, Spacen Jasset wrote:
immutable(ElementEncodingType!(ElementType!Range))[] 
buildPath(Range)(Range segments) if (isInputRange!Range && 
isSomeString!(ElementType!Range));
pure nothrow @safe immutable(C)[] buildPath(C)(const(C)[][] 
paths...) if (isSomeChar!C);


this is stodgy, particularly in a console with line wrapping 
at 80 chars.



To be fair it was the docs page I was reading not a compiler 
diagnostic, but I did get something a bit shorter from the 
compiler once.


Oh i see. Then i don't agree. Doc is very nice. The problem is 
that you have to know std.traits and std.range to understand the 
constraints. It's not always obvious but i'd say it's about 30 or 
40 functions.





Re: observation: D getting a bit complex

2015-08-30 Thread Spacen Jasset via Digitalmars-d-learn

On Sunday, 30 August 2015 at 07:36:55 UTC, BBasile wrote:

On Sunday, 30 August 2015 at 02:42:30 UTC, Spacen Jasset wrote:
immutable(ElementEncodingType!(ElementType!Range))[] 
buildPath(Range)(Range segments) if (isInputRange!Range && 
isSomeString!(ElementType!Range));
pure nothrow @safe immutable(C)[] buildPath(C)(const(C)[][] 
paths...) if (isSomeChar!C);


this is stodgy, particularly in a console with line wrapping at 
80 chars.



To be fair is was the docs page I was reading not a compiler 
diagnostic, but I did get something a bit shorter from the 
compiler once.


It's slighty hard to see that you can give that function a 
string, and that it can return a string like thing -- although on 
that score too I've found I have to use char[] in some places 
instead of string which is to do with immutability, that I've not 
quite worked that out yet either -- It's just a feeling I have 
when looking at this now that it is quite complex.


I only mention this as it was something that I think other people 
may notice too, when starting out, or coming back to D.


Maybe I've just been doing too much python recently.





Re: observation: D getting a bit complex

2015-08-30 Thread cym13 via Digitalmars-d-learn
On Sunday, 30 August 2015 at 09:55:02 UTC, Dominikus Dittes 
Scherkl wrote:
And the constraints you need not read - unless you want to 
understand why your call to the function failed. C++ is just 
lacking without them. Having them avoids that you always have 
to handle ridiculous input within your functions and allows to 
concentrate on meaningful code.


Maybe we should color thoses things, having syntax highlighting 
for template and functions signatures would be great.


Re: observation: D getting a bit complex

2015-08-30 Thread Dominikus Dittes Scherkl via Digitalmars-d-learn

On Sunday, 30 August 2015 at 07:36:55 UTC, BBasile wrote:

On Sunday, 30 August 2015 at 02:42:30 UTC, Spacen Jasset wrote:
immutable(ElementEncodingType!(ElementType!Range))[] 
buildPath(Range)(Range segments) if (isInputRange!Range && 
isSomeString!(ElementType!Range));
pure nothrow @safe immutable(C)[] buildPath(C)(const(C)[][] 
paths...) if (isSomeChar!C);


this is stodgy, particularly in a console with line wrapping at 
80 chars.


Could have been written as

auto buildPath(Range)(Range segments)
if (isInputRange!Range && isSomeString!(ElementType!Range));

but having an explicit return type is super valuable information. 
But the opportunity to omit it makes implementing a first working 
version so fast that it is pure joy.


And the constraints you need not read - unless you want to 
understand why your call to the function failed. C++ is just 
lacking without them. Having them avoids that you always have to 
handle ridiculous input within your functions and allows to 
concentrate on meaningful code.


Re: observation: D getting a bit complex

2015-08-30 Thread BBasile via Digitalmars-d-learn

On Sunday, 30 August 2015 at 02:42:30 UTC, Spacen Jasset wrote:
immutable(ElementEncodingType!(ElementType!Range))[] 
buildPath(Range)(Range segments) if (isInputRange!Range && 
isSomeString!(ElementType!Range));
pure nothrow @safe immutable(C)[] buildPath(C)(const(C)[][] 
paths...) if (isSomeChar!C);


this is stodgy, particularly in a console with line wrapping at 
80 chars.




Re: observation: D getting a bit complex

2015-08-29 Thread Jack Stouffer via Digitalmars-d-learn

On Sunday, 30 August 2015 at 02:42:30 UTC, Spacen Jasset wrote:
immutable(ElementEncodingType!(ElementType!Range))[] 
buildPath(Range)(Range segments) if (isInputRange!Range && 
isSomeString!(ElementType!Range));
pure nothrow @safe immutable(C)[] buildPath(C)(const(C)[][] 
paths...) if (isSomeChar!C);


I understand how you feel. When I was learning D, the docs where 
almost impenetrable because of this. But when I got into some of 
the more advanced features of D, I found these explicit function 
signatures invaluable. This essentially tells you that the 
function takes either a range of strings, or it can take 
indefinite number of strings as different arguments.


Also, examples underneath the function signature help new comers 
understand how to call the function without having to parse it.


Re: observation: D getting a bit complex

2015-08-29 Thread Sergey Korshunoff via Digitalmars-d-learn
Hi!
I completely agree. D1 is much better :-) I removed a threading
support from my variant  because program don't start if OS don't have
a POSIX threading (LInux 2.4.37 for example). A garbage colllector can
be disabled (as I understand). May be a compiler support (warnings) is
needed if gc will be used (needed) in the code

With such changes D1 can be used for Linux kernel modules. But I don't
done this yet. I nice stuff: libc written in D (a small part of the
uCLibc, not finished)

PS: trying to understand a D backend I removed all stuff related to
the C++ and win32
PPS: what is the rigth way to connect a backed to the frontend? I
studied only d-to-js, d-to-c, d-to-c#, tdc and some version of the D0
compiler with custom asm generator (GDC and LDC are not studied)


2015-08-30 5:42 GMT+03:00, Spacen Jasset via Digitalmars-d-learn
:
> The following reminds me of the good old C++ template errors the
> C++ compiler spits out.
>
> Whilst D has fixed that problem, some things have gotten more
> complex. I just wanted to find a replacement for D1 path join,
> and found this, but it doesn't seem very easy to wade though this
> stuff.
>
>
> immutable(ElementEncodingType!(ElementType!Range))[]
> buildPath(Range)(Range segments) if (isInputRange!Range &&
> isSomeString!(ElementType!Range));
> pure nothrow @safe immutable(C)[] buildPath(C)(const(C)[][]
> paths...) if (isSomeChar!C);
>
> http://dlang.org/phobos/std_path.html
>
> It would take me a lot of time to appeciate what that all means,
> although I can imagine what it is for.
>
> ...just and observation. The complexity is building.
>


observation: D getting a bit complex

2015-08-29 Thread Spacen Jasset via Digitalmars-d-learn
The following reminds me of the good old C++ template errors the 
C++ compiler spits out.


Whilst D has fixed that problem, some things have gotten more 
complex. I just wanted to find a replacement for D1 path join, 
and found this, but it doesn't seem very easy to wade though this 
stuff.



immutable(ElementEncodingType!(ElementType!Range))[] 
buildPath(Range)(Range segments) if (isInputRange!Range && 
isSomeString!(ElementType!Range));
pure nothrow @safe immutable(C)[] buildPath(C)(const(C)[][] 
paths...) if (isSomeChar!C);


http://dlang.org/phobos/std_path.html

It would take me a lot of time to appeciate what that all means, 
although I can imagine what it is for.


...just and observation. The complexity is building.