Necessity of D Library (and/or Core Library)

2015-05-22 Thread Anthony Monterrosa via Digitalmars-d-learn
Does D require the standard library to function? Or to be more direct, does D as a language need its library, or core library, to function correctly? I have become very interested in how programming languages do their magic; how they interact with the computer itself, and their inner

Re: is expression with static if matches wrong type

2015-05-22 Thread tcak via Digitalmars-d-learn
On Saturday, 23 May 2015 at 04:35:55 UTC, tcak wrote: [code] import std.stdio; public void setMarker(M)( size_t markerIndex, M markerValue ) if( is(M: ulong) || is(M: long) || is(M: uint) || is(M: int) || is(M: ushort) || is(M: short) ||

is expression with static if matches wrong type

2015-05-22 Thread tcak via Digitalmars-d-learn
[code] import std.stdio; public void setMarker(M)( size_t markerIndex, M markerValue ) if( is(M: ulong) || is(M: long) || is(M: uint) || is(M: int) || is(M: ushort) || is(M: short) || is(M: ubyte) || is(M: byte) || is(M: char

Re: Python's features, which requires D

2015-05-22 Thread Dennis Ritchie via Digitalmars-d-learn
By the way, Python has deepDup :) http://rextester.com/KBFA82886

Re: Python's features, which requires D

2015-05-22 Thread Dennis Ritchie via Digitalmars-d-learn
On Friday, 22 May 2015 at 05:31:38 UTC, Ali Çehreli wrote: Here is my attempt: import std.stdio; import std.algorithm; import std.conv; import std.range; void main() { // Replace 'none' with 'all' to activate. version (none) { const n = 5; auto a = stdin

Re: Distinguish recursive Templates

2015-05-22 Thread Manfred Nowak via Digitalmars-d-learn
Timon Gehr wrote: > template getDepth(T){ > static if(is(T==Set!S,S)) enum getDepth=1+getDepth!S; > else enum getDepth=0; > } Thx. Seems that I have to relearn a lot. -manfred

Re: Distinguish recursive Templates

2015-05-22 Thread Timon Gehr via Digitalmars-d-learn
On 05/23/2015 12:12 AM, Manfred Nowak wrote: Matt Kline wrote: isn't making any use of the template argument T Correct. I do not know how to use `T' to determine the recursion depth of the template---and I want no further parameter. -manfred import std.stdio, std.range, std.algorithm; te

Re: Distinguish recursive Templates

2015-05-22 Thread Manfred Nowak via Digitalmars-d-learn
Matt Kline wrote: > isn't making any use of the template argument T Correct. I do not know how to use `T' to determine the recursion depth of the template---and I want no further parameter. -manfred

Re: Distinguish recursive Templates

2015-05-22 Thread Matt Kline via Digitalmars-d-learn
On Friday, 22 May 2015 at 21:13:50 UTC, Manfred Nowak wrote: How can one determine the recursion depth for templated types? Example code: import std.stdio; class Set(T){ override string toString(){ return "Set"; } } void main(){ auto s0= new Set!uint; writeln( s0); // writes Set

Distinguish recursive Templates

2015-05-22 Thread Manfred Nowak via Digitalmars-d-learn
How can one determine the recursion depth for templated types? Example code: import std.stdio; class Set(T){ override string toString(){ return "Set"; } } void main(){ auto s0= new Set!uint; writeln( s0); // writes Set auto s1= new Set!(Set!uint); writeln( s1); // should write Se

Differences between C++11 atomics and core.atomics?

2015-05-22 Thread rsw0x via Digitalmars-d-learn
There's very little writing about D's core.atomics(TDPL seems to very barely cover them, I assume it's because it's aging compared to the library.) Is it safe to assume that they behave similarly to C++11's atomics?

Re: std.parallelism and multidimensional arrays

2015-05-22 Thread Vlad Levenfeld via Digitalmars-d-learn
On Friday, 22 May 2015 at 10:54:36 UTC, Stefan Frijters wrote: I have a code which does a lot of work on 2D/3D arrays, for which I use the 2.066 multidimensional slicing syntax through a fork of the Unstandard package [1]. Many times the order of operations doesn't matter and I thought I would

Re: What is a mutable method?

2015-05-22 Thread Jonathan M Davis via Digitalmars-d-learn
On Friday, May 22, 2015 12:12:45 tcak via Digitalmars-d-learn wrote: > I know there is mutable variables, but what is a mutable method? > > Error message says "mutable method > project.mariadb.connector.ver2p1.resultset.ResultSetColumn.info > is not callable using a const object". It's a method /

Re: What happens when you launch a D application ?

2015-05-22 Thread Steven Schveighoffer via Digitalmars-d-learn
On 5/22/15 2:36 AM, Suliman wrote: On SO[1] I got next answer: "What happens when you launch a D application ? The entry point is a C main inside the runtime, which initialize it (the runtime), including module constructor, run the unittest (if you've compiled with -unittest), then call your mai

Re: What is a mutable method?

2015-05-22 Thread Steven Schveighoffer via Digitalmars-d-learn
On 5/22/15 8:12 AM, tcak wrote: I know there is mutable variables, but what is a mutable method? Error message says "mutable method project.mariadb.connector.ver2p1.resultset.ResultSetColumn.info is not callable using a const object". English grammar nit: I would say mutating instead of mutabl

Re: opIndex vs. opSlice for empty slices

2015-05-22 Thread Steven Schveighoffer via Digitalmars-d-learn
On 5/22/15 1:49 AM, weaselcat wrote: On Friday, 22 May 2015 at 05:47:28 UTC, Mike Parker wrote: I've always used opSlice to produce empty slices, but having recently read the documentation at [1], I see this: "To overload a[], simply define opIndex with no parameters:" And no mention that opSl

Re: What happens when you launch a D application ?

2015-05-22 Thread Adam D. Ruppe via Digitalmars-d-learn
On Friday, 22 May 2015 at 13:26:32 UTC, Suliman wrote: So what what would call at first ? The operating system starts the program Then the extern(C) int main() gets called. Then the _Dmain gets called.

Re: What happens when you launch a D application ?

2015-05-22 Thread Suliman via Digitalmars-d-learn
Really hard to understand... So what what would call at first ? extern(C) int main() or int _Dmain()

Re: What is a mutable method?

2015-05-22 Thread FreeSlave via Digitalmars-d-learn
On Friday, 22 May 2015 at 12:12:46 UTC, tcak wrote: I know there is mutable variables, but what is a mutable method? Error message says "mutable method project.mariadb.connector.ver2p1.resultset.ResultSetColumn.info is not callable using a const object". The method that can change the state

What is a mutable method?

2015-05-22 Thread tcak via Digitalmars-d-learn
I know there is mutable variables, but what is a mutable method? Error message says "mutable method project.mariadb.connector.ver2p1.resultset.ResultSetColumn.info is not callable using a const object".

Re: What happens when you launch a D application ?

2015-05-22 Thread John Colvin via Digitalmars-d-learn
On Friday, 22 May 2015 at 11:51:01 UTC, John Colvin wrote: On Friday, 22 May 2015 at 11:13:43 UTC, Suliman wrote: Am I right understand that that: 1. every App start from main() 2. Dmain is function that run after main is started and it's run GC, unit-tests and so on? Not really, it depends w

Re: What happens when you launch a D application ?

2015-05-22 Thread John Colvin via Digitalmars-d-learn
On Friday, 22 May 2015 at 11:13:43 UTC, Suliman wrote: Am I right understand that that: 1. every App start from main() 2. Dmain is function that run after main is started and it's run GC, unit-tests and so on? Not really, it depends what you mean by main, the function called main that you wri

Re: What happens when you launch a D application ?

2015-05-22 Thread Suliman via Digitalmars-d-learn
Am I right understand that that: 1. every App start from main() 2. Dmain is function that run after main is started and it's run GC, unit-tests and so on?

std.parallelism and multidimensional arrays

2015-05-22 Thread Stefan Frijters via Digitalmars-d-learn
I have a code which does a lot of work on 2D/3D arrays, for which I use the 2.066 multidimensional slicing syntax through a fork of the Unstandard package [1]. Many times the order of operations doesn't matter and I thought I would give the parallelism module a try to try and get some easy spee

Re: ImplicitConversionTargets opposite

2015-05-22 Thread Baz via Digitalmars-d-learn
the line warping on this forum deserve a big slap in the face...

Re: ImplicitConversionTargets opposite

2015-05-22 Thread Baz via Digitalmars-d-learn
On Thursday, 21 May 2015 at 21:49:55 UTC, Freddy wrote: std.traits has ImplicitConversionTargets. Is there any template that returns the types that can implicty convert to T? You can write something like this: --- import std.stdio; import std.traits; import std.typetuple; void main(string[]

Re: What happens when you launch a D application ?

2015-05-22 Thread John Colvin via Digitalmars-d-learn
On Friday, 22 May 2015 at 06:36:27 UTC, Suliman wrote: On SO[1] I got next answer: "What happens when you launch a D application ? The entry point is a C main inside the runtime, which initialize it (the runtime), including module constructor, run the unittest (if you've compiled with -unitte

Re: ImplicitConversionTargets opposite

2015-05-22 Thread via Digitalmars-d-learn
On Thursday, 21 May 2015 at 21:49:55 UTC, Freddy wrote: std.traits has ImplicitConversionTargets. Is there any template that returns the types that can implicty convert to T? I doubt that, because it's an open set (alias this, inheritance). However, it should be possible to iterate over all t

Re: opIndex vs. opSlice for empty slices

2015-05-22 Thread Mike Parker via Digitalmars-d-learn
On Friday, 22 May 2015 at 06:28:16 UTC, Ali Çehreli wrote: http://ddili.org/ders/d.en/operator_overloading.html#ix_operator_overloading.opSlice http://ddili.org/ders/d.en/templates_more.html#ix_templates_more.overloading,%20operator Ali Thanks, Ali. I've actually looked over that already an