Re: Better unittest failure output

2015-09-07 Thread anonymous via Digitalmars-d-learn
On Monday 07 September 2015 13:57, Bahman Movaqar wrote: > I am working on a simple project created with DUB[1]. > When unit tests the output reads really cryptic to me; for > example: > > $ dub test [...] > core.exception.AssertError@source/e002.d(111): unittest > failure [...] > >

Re: What are (dis)advantages of using pure and immutable by default?

2015-09-07 Thread anonymous via Digitalmars-d-learn
On Monday 07 September 2015 12:40, Bahman Movaqar wrote: > It seems to me a good practice to mark all functions that I write > as `pure` and define all the variables as `immutable`, unless > there is a reason not to. I agree. > I can see some serious advantages of this, most notable of which

Re: function argument restrictions for templated struct

2015-09-07 Thread anonymous via Digitalmars-d-learn
On Monday 07 September 2015 17:51, Laeeth Isharc wrote: > Is there a more elegant way to write the template arg > restrictions for display? [...] > void display(T)(T a) > if (__traits(isSame, TemplateOf!(T), Bar)) > { > writefln("%s",a); > } if (isInstanceOf!(Bar, T))

Re: Better unittest failure output

2015-09-07 Thread anonymous via Digitalmars-d-learn
On Monday 07 September 2015 14:12, Bahman Movaqar wrote: > Thanks. This is indeed helpful. OT but where can I view the > documentation for `unittest` and `assert`? unittest: http://dlang.org/unittest.html assert: http://dlang.org/expression.html#AssertExpression (I don't know why it's

Re: Windows Header consts

2015-09-07 Thread anonymous via Digitalmars-d-learn
On Monday 07 September 2015 21:06, Prudence wrote: > If you think mentally changing a . to a _ is a hassle then your > in trouble! An apple a day simply won't help! [...] > Oh well, some people > just don't like progress! Do you want to go back to using wooden > wheels too? [...] > Get out of

Re: AST like coding syntax. Easy upgrade!

2015-09-06 Thread anonymous via Digitalmars-d
On Monday 07 September 2015 02:24, Idan Arye wrote: > That's not considered as syntax check - that's an earlier stage > of the compilation process called "lexical > analysis"(https://en.wikipedia.org/wiki/Lexical_analysis) >From the Wikipedia article: "a lexer is generally combined with a

Re: AST like coding syntax. Easy upgrade!

2015-09-06 Thread anonymous via Digitalmars-d
On Monday 07 September 2015 00:37, cym13 wrote: > There already is a kind of "code string": > > interpret(q{ > var a = 2; > var b += a; > }); > > It doesn't do any kind of syntax check, but there again how do > you want to have syntax check for any language? The D

Re: 1st Ever Artificial Consciousness to be Written in D Language

2015-09-06 Thread anonymous via Digitalmars-d-announce
On Sunday, 6 September 2015 at 09:42:53 UTC, Grand_Axe wrote: On Wednesday, 2 September 2015 at 21:13:12 UTC, anonymous wrote: On Wednesday, 2 September 2015 at 14:41:20 UTC, GrandAxe wrote: Unnetworked personal mobile devices are the target platform for the standard implementation of OBI.

Re: reading file byLine

2015-09-06 Thread anonymous via Digitalmars-d-learn
On Sunday, 6 September 2015 at 15:41:34 UTC, Namal wrote: is there any function that removes double elements in a sorted array? std.algorithm.iteration.uniq http://dlang.org/phobos/std_algorithm_iteration.html#uniq

Re: reading file byLine

2015-09-06 Thread anonymous via Digitalmars-d-learn
On Sunday, 6 September 2015 at 16:17:29 UTC, Namal wrote: Error: module comparison is in file 'std/algorithm/comparison.d' which cannot be read import path[0] = /usr/include/dmd/phobos import path[1] = /usr/include/dmd/druntime/import when I try to load the headers like in the example Are

Re: Abstractioning away main/winMain

2015-09-05 Thread anonymous via Digitalmars-d-learn
On Saturday 05 September 2015 07:52, anonymous wrote: > This doesn't work because delegates and static initialization don't go > together. You can use a static constructor: > > > const Application MyApp; > static this() > { > Application.New({import std.stdio; std.stdio.writeln("MY APP

Re: Superfluous code in switch statement

2015-09-04 Thread anonymous via Digitalmars-d-learn
On Friday 04 September 2015 23:04, Timon Gehr wrote: > DMD never warns about dead code. It warns here: import std.stdio; void main() { return; writeln("hi"); /* Warning: statement is not reachable */ }

Re: Abstractioning away main/winMain

2015-09-04 Thread anonymous via Digitalmars-d-learn
On Saturday 05 September 2015 03:43, Prudence wrote: > Standard and Win32 apps are so old school! > > I'd like to hide WinMain by wrapping it in an application > class(more or less). > > Essentially I have an Application class > > class Application > { > public static Application New(void

Re: Problem with using struct ranges with @disabled this(this) with some range functions

2015-09-02 Thread anonymous via Digitalmars-d-learn
On Wednesday 02 September 2015 09:52, Uranuz wrote: > I want to understand if we have *save* method in Forward Range > then why or in which cases we should use plain struct copying > instead. Should we assume that these two ways are equal or not? No, don't assume that they're the same. > Also

Re: new static array

2015-09-02 Thread anonymous via Digitalmars-d-learn
On Wednesday, 2 September 2015 at 06:04:40 UTC, Ali Çehreli wrote: > with int[4] it compiles and runs. int[][4] fails. Is this a bug? I think so. https://issues.dlang.org/show_bug.cgi?id=15004 may related to https://issues.dlang.org/show_bug.cgi?id=10740

Re: 1st Ever Artificial Consciousness to be Written in D Language

2015-09-02 Thread anonymous via Digitalmars-d-announce
On Wednesday, 2 September 2015 at 14:41:20 UTC, GrandAxe wrote: Unnetworked personal mobile devices are the target platform for the standard implementation of OBI. What hardware/OS (if any) will you use? Depending on the answer: do you plan to submit PR to extend plattform support of the

new static array

2015-09-01 Thread anonymous via Digitalmars-d-learn
Hello, I tried to send a string[4] with std.concurrency: import std.concurrency; import std.stdio; void fun() { receive((string[4] data) { writeln(data);}); } void main() { string[4] data; auto tid = spawn(); send(tid, data); } I got (dmd 2.068)

Re: Dynamic arrays

2015-08-31 Thread anonymous via Digitalmars-d-announce
On Monday 31 August 2015 23:09, Minas Mina wrote: > I have started a series of tutorials in D. > > This is my latest blog post, which is about dynamic arrays: > http://minas-mina.com/2015/08/31/dynamic-arrays/ > > Constructive criticism is welcome. "Dynamic arrays are allocated on the garbage

Re: Dynamic arrays

2015-08-31 Thread anonymous via Digitalmars-d-announce
On Monday 31 August 2015 23:36, John Colvin wrote: > I prefer the term "slice" to dynamic array. Because it's an > unfamiliar term it helps prevent confusion for people who are > used to what other languages call dynamic arrays. I'm not a fan of the term "slice". Not because I dislike the word

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);

Re: Challenge

2015-08-30 Thread anonymous via Digitalmars-d
On Sunday 30 August 2015 12:21, rsw0x wrote: import std.algorithm, std.range; auto foo(R)(R a, immutable int b) { return a.map!(x = x + b); } @nogc @safe unittest { int[3] test = [1,2,3]; assert(test[].foo(3).equal(only(4,5,6))); } does this count? I think this

Re: Challenge

2015-08-30 Thread anonymous via Digitalmars-d
On Sunday 30 August 2015 16:43, rsw0x wrote: Is there any reason that closure in this particular example can't be created on the stack? Seems a bit weird. It may be possible to store it on the stack somehow, or as part of the map struct. I don't know. The point is, that's not what happens.

Re: Reading and converting binary file 2 bits at a time

2015-08-29 Thread anonymous via Digitalmars-d-learn
On Saturday, 29 August 2015 at 23:34:47 UTC, Gary Willoughby wrote: But it might not be safe: http://forum.dlang.org/thread/ztefzijqhwrouzlag...@forum.dlang.org That link just takes me to this thread here again.

Re: Arrays of structs

2015-08-27 Thread anonymous via Digitalmars-d-learn
On Thursday 27 August 2015 14:35, BBasile wrote: Anyway. I cheat a bit with attributes but as long as it's only for me...I know this kinds of functions are not phobos-level. Sure, as long as you're cautious and regard those functions as unsafe, you may be fine. You still risk accidentally

Re: What is this function call operator?

2015-08-27 Thread anonymous via Digitalmars-d-learn
On Thursday 27 August 2015 17:18, Gary Willoughby wrote: What is this function call operator? (...) Where can i learn more about it? http://dlang.org/operatoroverloading.html#function-call http://ddili.org/ders/d.en/operator_overloading.html#ix_operator_overloading.opCall

Re: Arrays of structs

2015-08-27 Thread anonymous via Digitalmars-d-learn
On Thursday 27 August 2015 13:15, BBasile wrote: https://github.com/BBasile/iz/blob/master/import/iz/types.d#L125 https://github.com/BBasile/iz/blob/master/import/iz/types.d#L150 https://github.com/BBasile/iz/blob/master/import/iz/types.d#L191 Your use of @trusted is wrong and dangerous.

Re: multiline string literal with CRLF

2015-08-26 Thread anonymous via Digitalmars-d-learn
On Wednesday 26 August 2015 20:28, Marek Janukowicz wrote: Is there any way to input such a literal? Both `...` and qEOS...EOS do not allow escape sequences. I'm on Linux, but I need precisely CRLF, not just \n. I'm probably missing the point, but: Hello\r\nworld Or if you want to include

Re: Casting pointers

2015-08-26 Thread anonymous via Digitalmars-d-learn
On Wednesday 26 August 2015 14:14, John Burton wrote: This would be undefined behavior in c++ due to aliasing rules on pointers. It appears to work reliably in D when I try it, but that's obviously no guarantee that it's correct or will continue to do so. Is this correct code in D? And if

Re: NYT data article based on work of EMSI, who I think are a D shop

2015-08-25 Thread anonymous via Digitalmars-d-learn
On Tuesday 25 August 2015 06:55, Laeeth Isharc wrote: http://www.nytimes.com/2015/08/23/magazine/the-creative-apocalypse-that-wasnt.html Interesting article as it corrects misconceptions of a few years back by looking at the data. This is based on tools from EMSI, who are a D shop.

Re: C++/STL interop

2015-08-25 Thread anonymous via Digitalmars-d-learn
On Monday 24 August 2015 17:37, anonymous wrote: I saw https://issues.dlang.org/show_bug.cgi?id=14956 . questions: - is std.basic_string released into the wild? - where do I find std.basic_string? - does std.vector exist? That would allow me to get rid of some C++ clue code (build an

Re: Runtime error in code on main page

2015-08-25 Thread anonymous via Digitalmars-d
On Tuesday 25 August 2015 10:40, BBasile wrote: please, stop spamming about that. [...] and file an issue on the bug tracker. God damnit. Easy there. We don't want to discourage people from reporting bugs.

Re: NYT data article based on work of EMSI, who I think are a D shop

2015-08-25 Thread anonymous via Digitalmars-d-learn
On Wednesday 26 August 2015 00:22, Laeeth Isharc wrote: I'm open to being corrected about where the right place should be, but it wasn't an accidental decision to post here. I think you might find more interest over in General. Learn tends to be a question/answer kind of thing. So people

C++/STL interop

2015-08-24 Thread anonymous via Digitalmars-d-learn
I saw https://issues.dlang.org/show_bug.cgi?id=14956 . questions: - is std.basic_string released into the wild? - where do I find std.basic_string? - does std.vector exist? That would allow me to get rid of some C++ clue code (build an C-like interface, copy data etc)... Putting extern(C++)

Re: Casting double to ulong weirdness

2015-08-24 Thread anonymous via Digitalmars-d
On Monday 24 August 2015 18:52, wrote: import std.stdio; void main() { double x = 1.2; writeln(cast(ulong)(x * 10.0)); double y = 1.2 * 10.0; writeln(cast(ulong)y); } Output: 11 12 to!ulong instead of the cast does the right thing, and is a viable work-around.

Re: How to use ranges?

2015-08-23 Thread anonymous via Digitalmars-d-learn
On Sunday 23 August 2015 19:58, Doolan wrote: You can use typeof to get the type of a range expression when typing it out is impractical/impossible. What if I want to save a range in a struct? Or is a range more of a verb than a noun..? Can still use typeof then: struct S { import

Re: Trying to compile weather program

2015-08-23 Thread anonymous via Digitalmars-d-learn
On Sunday 23 August 2015 11:54, Tony wrote: weather_report.d(32): Error: undefined identifier centerJustifier `centerJustifier` is new in 2.068. You're probably using an older version of D. You can replace `centerJustifier` with `center` here.

Re: How to use ranges?

2015-08-23 Thread anonymous via Digitalmars-d-learn
On Sunday 23 August 2015 12:17, Doolan wrote: And the use of auto everywhere makes it really hard to tell what types I should be using for anything. My compiler talks about RangeT!(whatever) but you try to use RangeT!(whatever) and you find out RangeT is private... You can use typeof to get

Re: Wiki article: Starting as a Contributor

2015-08-22 Thread anonymous via Digitalmars-d
On Saturday 22 August 2015 11:05, ted wrote: From here, I can go to 'Building DMD' and 'How to Fork and Build dlang.org', which both seem to build DMD - I'm unsure of the overlap aspects here. The 'dlang.org' project is the website. It deals with building dmd only insofar as you need a

Re: string - null/bool implicit conversion

2015-08-20 Thread anonymous via Digitalmars-d
On Thursday, 20 August 2015 at 16:45:18 UTC, Márcio Martins wrote: Hi! string a = ; string b; writeln(a ? a : null); writeln(b ? b : null); This program outputs: a null What? I suppose this is by design, but are there any plans to deprecate this? A compiler change disallowing such

Re: cannot initialize static array by static this()

2015-08-20 Thread anonymous via Digitalmars-d
On Thursday 20 August 2015 08:33, aki wrote: Is this a bug? Yes. Please file a bug at https://issues.dlang.org/.

Re: Why does not my program is not running?

2015-08-20 Thread anonymous via Digitalmars-d-learn
On Thursday 20 August 2015 22:31, Unknow wrote: I'm writed a program for calculating the e number. I can compile the source code but when i try run the program, system gives 'program stopped working' error. Source code; // main.d module main; import std.file; import std.conv;

Re: Why does not my program is not running?

2015-08-20 Thread anonymous via Digitalmars-d-learn
On Thursday 20 August 2015 23:11, anonymous wrote: 2) *integer++ doesn't do what you think it does. The increment is done before the dereference. You could fix this, but: I got that one wrong. Steven Schveighoffer has it right. The pointer is incremented after the currently pointed-to value

Re: Build It And They Will Not Come

2015-08-20 Thread anonymous via Digitalmars-d-announce
On Thursday 20 August 2015 17:18, Daniel wrote: Anyway, I didn't know about Ali's book. Maybe it could be linked at dlang.org's left menu? It's the first link on the Getting Started page (added somewhat recently). And it's the first link in the Books Articles section. I wouldn't oppose a

Re: dmd codegen improvements

2015-08-19 Thread anonymous via Digitalmars-d
On Tuesday, 18 August 2015 at 10:45:49 UTC, Walter Bright wrote: So if you're comparing code generated by dmd/gdc/ldc, and notice something that dmd could do better at (1, 2 or 3), please let me know. Often this sort of thing is low hanging fruit that is fairly easily inserted into the back

Re: Programming in D paper book is available for purchase

2015-08-19 Thread anonymous via Digitalmars-d-announce
On Wednesday, 19 August 2015 at 15:53:27 UTC, Luís Marques wrote: On Wednesday, 19 August 2015 at 00:57:32 UTC, Ali Çehreli wrote: [...] Ali, congratulations on releasing such a complete book on D! I know this took you an immense effort, as these things always do, but the results speak

Re: dmd codegen improvements

2015-08-19 Thread anonymous via Digitalmars-d
On Wednesday, 19 August 2015 at 17:30:13 UTC, Walter Bright wrote: On 8/19/2015 7:34 AM, anonymous wrote: I have a about 30 lines of numerical code (using real) where the gap is about 200%-300% between ldc/gdc and dmd (linux x86_64). In fact dmd -O etc is at the level of ldc/gdc without any

Re: dmd codegen improvements

2015-08-18 Thread anonymous via Digitalmars-d
On Tuesday, 18 August 2015 at 15:22:15 UTC, Joakim wrote: Also, soon the dmd compiler backend will be the only one written in D. :) Soon the front end will be written in D. And the front end is shared among dmd, gdc, ldc. Walter has expressed a desire to port the back end to D, too [1]. But

Re: How to provide this arg or functor for algorithm?

2015-08-17 Thread anonymous via Digitalmars-d-learn
On Sunday, 16 August 2015 at 23:05:42 UTC, Ali Çehreli wrote: // Now the type of d is a template parameter @nogc auto func(Func)(uint[] arr, Func d) { return arr.map!(d); } Huh. I think func being a template is the key here. When the original code is put in a template, it works too (with

Re: else if for template constraints

2015-08-17 Thread anonymous via Digitalmars-d
On Monday, 17 August 2015 at 22:32:10 UTC, Idan Arye wrote: On Monday, 17 August 2015 at 21:27:47 UTC, Meta wrote: [...] At that point, couldn't you just use static if inside the body of the template instead of using template constraints? No. Consider this:

Re: std.net.curl

2015-08-17 Thread anonymous via Digitalmars-d-learn
On Monday, 17 August 2015 at 13:13:48 UTC, anonymous wrote: and figured out that the linker is invoked (on my machine) with gcc a.o -o a -m64 -lcurl -L/usr/lib/x86_64-linux-gnu -Xlinker correct (I named the example programm a.d instead of app.d): gcc app.o -o app -m64 -lcurl

Re: How to provide this arg or functor for algorithm?

2015-08-17 Thread anonymous via Digitalmars-d-learn
On Monday, 17 August 2015 at 10:28:33 UTC, thedeemon wrote: Nope, it works only because r is unreferenced and gets thrown out. Just try using r.front there, for example, and the error returns. You're right, it falls short. But I think r not being referenced is not exactly it. Using front in

Re: std.net.curl

2015-08-17 Thread anonymous via Digitalmars-d-learn
On Monday, 17 August 2015 at 12:58:54 UTC, Adam D. Ruppe wrote: On Monday, 17 August 2015 at 12:52:37 UTC, tired_eyes wrote: Hovewer, dmd app.d spits a whole bunch of strange error messages: try dmd -lcurl app.d and see if that helps. DMD does not accept -lcurl. From dmd --help:

Re: How to provide this arg or functor for algorithm?

2015-08-17 Thread anonymous via Digitalmars-d-learn
On Monday, 17 August 2015 at 16:21:16 UTC, thedeemon wrote: On Monday, 17 August 2015 at 16:18:50 UTC, thedeemon wrote: I've just checked with my runtime GC hook. Here the call to func() allocates 12 bytes via gc_malloc, and it's the same for a 4-elements array, so it's not for the array

Re: 2.068 Regression in EnumMembers?

2015-08-16 Thread anonymous via Digitalmars-d-learn
On Sunday, 16 August 2015 at 11:25:48 UTC, Nordlöw wrote: I tried rebuilding my knowledge graph project at https://github.com/nordlow/justd/tree/master/knet with DMD 2.068 and it seems like we have a regression in std.traits: EnumMembers: [...] It builds without errors nor warnings on

Re: using memset withing a pure function

2015-08-15 Thread anonymous via Digitalmars-d-learn
On Saturday, 15 August 2015 at 19:50:56 UTC, Temtaime wrote: There's a problem with « dst[0 .. n] = val; ». It should be « dst[0 .. n][] = val; » No, you don't need the `[]`.

Re: using memset withing a pure function

2015-08-15 Thread anonymous via Digitalmars-d-learn
On Saturday, 15 August 2015 at 18:04:30 UTC, D_Learner wrote: memcpy(skip[0], skip[0]+shift, (m-shift)*(int.sizeof)); memset(skip[0]+(m-shift),0, shift*(int.sizeof)) I was thinking conversion would be :- skip[0 .. size-1] = skip[shift .. size-1 ]; //For the memcpy(); Those

Re: Passing parameters to thread functions

2015-08-15 Thread anonymous via Digitalmars-d
On Saturday, 15 August 2015 at 12:22:08 UTC, D_Starter wrote: int main() { uint var = 7; auto thread1 = new Thread(thread_proc, val).start(); /* similar to C++ STL */ thread1.join(); return 0; } [/CODE] You might have guessed...this won't work. So how do I pass parameters

Re: Bug in std.container: SList

2015-08-15 Thread anonymous via Digitalmars-d
On Friday, 14 August 2015 at 19:44:17 UTC, Xinok wrote: On Friday, 14 August 2015 at 18:12:42 UTC, anonymous wrote: Other insert* functions call the private function SList.initialize() which does the null-check for _root. I am working on a PR adding the missing call in insertAfter - that's a

Re: I'm confused about ranges (input and forward in practice, in algorithms)

2015-08-14 Thread anonymous via Digitalmars-d
On Friday, 14 August 2015 at 00:33:30 UTC, Luís Marques wrote: Despite using them all the time, I'm suddenly confused about ranges... My understanding is that (for library-worth code) algorithms that consume ranges are supposed to use .save() to be compatible with both ref type and value

Re: Associative array literal. Why doesn't it compile?

2015-08-14 Thread anonymous via Digitalmars-d-learn
On Friday, 14 August 2015 at 07:04:53 UTC, BBasile wrote: It's because of the key type (string is a library type). This is not true. It's not because of the key type. And string is not a library type.

Re: Bug in std.container: SList

2015-08-14 Thread anonymous via Digitalmars-d
On Friday, 14 August 2015 at 16:28:39 UTC, Xinok wrote: I can confirm that this is a bug but I'm not sure what the correct way is to fix it. SList creates a dummy node for the root of the list, but because structs don't allow default constructors, this dummy node is never allocated in the

Re: using memset withing a pure function

2015-08-14 Thread anonymous via Digitalmars-d-learn
On Saturday, 15 August 2015 at 02:21:46 UTC, D_Learner wrote: Well, the actual error I got is : Error: memset cannot be interpreted at compile time, because it has no available source code . I seems to suggest I miss the actual code. I guess I gave you a wrong impression of how pure relates

Re: using memset withing a pure function

2015-08-14 Thread anonymous via Digitalmars-d-learn
On Saturday, 15 August 2015 at 02:21:46 UTC, D_Learner wrote: On Saturday, 15 August 2015 at 01:13:02 UTC, Adam D. Ruppe wrote: On Saturday, 15 August 2015 at 01:09:15 UTC, D_Learner wrote: When writting a pure fucntion involving C non pure functions like memcpy() and memset() Those

Re: SList container problem

2015-08-14 Thread anonymous via Digitalmars-d-learn
https://issues.dlang.org/show_bug.cgi?id=14920

Re: complete win headers for 32/64 bit

2015-08-13 Thread anonymous via Digitalmars-d-learn
On Thursday, 13 August 2015 at 16:28:15 UTC, learn wrote: unfortunately i can't find a complete set of windows header files. maybe one should add a link for those headers if they exist - life is not linux or osx only. https://github.com/etcimon/windows-headers

Re: Compiletime Table

2015-08-13 Thread anonymous via Digitalmars-d-learn
On Thursday, 13 August 2015 at 19:13:55 UTC, D_Learner wrote: I was wondering how I could change the code below such the `bmBc` is computed at compile time . The one below works for runtime but it is not ideal since I need to know the `bmBc` table at compile-time . I could appreciate advice

Re: Nested public imports - bug or feature?

2015-08-13 Thread anonymous via Digitalmars-d
On Thursday, 13 August 2015 at 15:29:19 UTC, Dicebot wrote: struct Something { public import a; } void main() { Something.foo(); } What's wrong with `import Something = a;`? Bugs?

Should these aliases kind be illegal ?

2015-08-12 Thread anonymous via Digitalmars-d-learn
The following alias declaration is totally legal but actually it's not usable --- class Foo { void something(size_t param){} } class Bar { private Foo foo; this(){foo = new Foo;} alias somethingelse = foo.something; } void main(string[] args) { auto bar = new Bar;

Re: Infinity loop with dates comparison

2015-08-11 Thread anonymous via Digitalmars-d-learn
On Tuesday, 11 August 2015 at 19:56:02 UTC, Suliman wrote: Date startDate = Date.fromISOExtString(2014-08-01); [...] Date nextday; while (nextday currentDate) { nextday = startDate + 1.days; writeln(nextday); } startDate

Re: Release D 2.068.0

2015-08-10 Thread anonymous via Digitalmars-d-announce
On Monday, 10 August 2015 at 15:41:39 UTC, Dominikus Dittes Scherkl wrote: Maybe the state should reflect this progress better, because these 3000 open and unassigned bug give a much worse impression of the state of D than the language really is in. People get easy turned away from D by that

Re: DCD 0.7.0-alpha1

2015-08-10 Thread anonymous via Digitalmars-d-announce
On Saturday, 8 August 2015 at 00:19:38 UTC, Brian Schott wrote: https://github.com/Hackerpilot/DCD/releases/tag/v0.7.0-alpha1 DCD is an IDE and editor-independent autocompletion system for the D programming language. Release notes are available at the above link. 0.7.0 has some major

Re: Release D 2.068.0

2015-08-10 Thread anonymous via Digitalmars-d-announce
On Monday, 10 August 2015 at 12:24:36 UTC, Dominikus Dittes Scherkl wrote: Congrats, but why are there still 6 Regressions / 34 Blockers open in Bugzilla? At least with the one that opens from the main D page /resouces/bugtracker. Is this a different tracker that's not up to date? Regarding

Re: Removing elements from dynamic array

2015-08-09 Thread anonymous via Digitalmars-d-learn
On Sunday, 9 August 2015 at 20:23:00 UTC, Reflexive wrote: I see that remove() removes the value of the element but keeps the same size of the array, and replace the value by a new one at the end. The method : class sabot{ card[] sabotarray ; (...) card getCard(){

Re: std.array: array, ulong and Win32

2015-08-09 Thread anonymous via Digitalmars-d-learn
On Sunday, 9 August 2015 at 20:13:38 UTC, ixid wrote: This seems like a reasonable use but errors, obviously I can do it in many other ways: ulong[] result = iota(1UL, 10UL).array; Error: static assert Argument types in (ulong) are not all convertible to size_t: (ulong)

Re: Concurrency Confusion

2015-08-09 Thread anonymous via Digitalmars-d-learn
On Sunday, 9 August 2015 at 17:43:59 UTC, 岩倉 澪 wrote: Afaict it is the best way to do what I'm trying to do, and since the data is mutable and cast to immutable with assumeUnique, casting it back to mutable shouldn't be a problem. Technically casting away immutable might be undefined

Re: std.stream.MemoryStream deprecated, range is the alternative?

2015-08-07 Thread anonymous via Digitalmars-d-learn
On Thursday, 6 August 2015 at 17:01:32 UTC, chris wrote: since memorystream is deprecated how do i do something like this with Input and Output ranges? How can i fill up an array with ranges like you can do with streams? Thanks. The InputRange primitives already exist for arrays, they are

Re: DCD 0.7.0-alpha1

2015-08-07 Thread anonymous via Digitalmars-d-announce
On Saturday, 8 August 2015 at 00:19:38 UTC, Brian Schott wrote: https://github.com/Hackerpilot/DCD/releases/tag/v0.7.0-alpha1 DCD is an IDE and editor-independent autocompletion system for the D programming language. Release notes are available at the above link. 0.7.0 has some major

Re: DCD 0.7.0-alpha1

2015-08-07 Thread anonymous via Digitalmars-d-announce
On Saturday, 8 August 2015 at 02:25:29 UTC, Joakim Brännström wrote: On Saturday, 8 August 2015 at 01:32:50 UTC, anonymous wrote: I'd like to test, particularly under Win, but std.experimental.allocator (+ std.meta) are still not merged. If I understand correctly it means that DCD 0.7 will not

Re: trouble compiling Fiber example code from docs dmd linux v2.067.1

2015-08-06 Thread anonymous via Digitalmars-d-learn
On Thursday, 6 August 2015 at 20:21:38 UTC, Carl Sturtivant wrote: I took the example code from here, http://dlang.org/phobos/core_thread.html#.Fiber and wrapped the statements at the bottom inside main() and put import core.thread and std.stdio at the top, and the compiler gave me the

Re: Changelog

2015-08-05 Thread anonymous via Digitalmars-d-announce
On Wednesday, 5 August 2015 at 19:04:29 UTC, Brian Schott wrote: Where does that changelog come from? I made some pull requests against a file that I thought was the changelog to document some Phobos changes that got merged, but now I don't see it on dlang.org.

Re: What is the order of resolution for super() calls?

2015-08-05 Thread anonymous via Digitalmars-d-learn
On Wednesday, 5 August 2015 at 12:32:48 UTC, cym13 wrote: For reference, as the diagram was unreadable, I'll describe it here: class Adam ; class Eve ; class Abel:Adam,Eve ; class Cain:Adam,Eve ; class David:Abel,Cain ; This is illegal D. You must use interfaces to simulate multiple

Re: D Wiki: Windows programming examples are missing

2015-08-05 Thread anonymous via Digitalmars-d-learn
On Wednesday, 5 August 2015 at 21:02:49 UTC, Andre Polykanine wrote: Hi everyone, I'm fairly new to D and am really excited about it. I would like to see more examples of Windows programming in D, but the repository indicated on the D wiki seems to be moved or deleted. More info is here:

Re: Trouble with template parameter matching

2015-08-02 Thread anonymous via Digitalmars-d-learn
On Sunday, 2 August 2015 at 08:08:05 UTC, tcak wrote: [code] void func1(N)( const N name ) if( is(N: string) || is(N: char[]) ) { func2( name ); } void func2(N)( const N name ) if( is(N: string) || is(N: char[]) ) {} void main(){ char[] blah = ['b', 'l', 'a',

Re: alias overloading strange error

2015-08-01 Thread anonymous via Digitalmars-d-learn
On Friday, 31 July 2015 at 11:09:39 UTC, anonymous wrote: Definitely a bug. Please file an issue at https://issues.dlang.org/. https://issues.dlang.org/show_bug.cgi?id=14858

Re: alias overloading strange error

2015-07-31 Thread anonymous via Digitalmars-d-learn
On Friday, 31 July 2015 at 10:56:33 UTC, vitus wrote: //Why expression 'foobar(1);' doesn't work? void foo()(){} void bar(int){} alias foobar = foo; alias foobar = bar; void main(){ .foobar(1); //OK foobar(1); //Error: overload alias 'foo' is not a

Re: Type inference of a function parameter

2015-07-29 Thread anonymous via Digitalmars-d-learn
On Wednesday, 29 July 2015 at 20:20:47 UTC, Adel Mamin wrote: void my_func(auto arr) { writeln(arr); } There are no `auto` parameters in D. You have to make it a template explicitly: void my_func(A)(A arr) { writeln(arr); }

Re: Error: 'this' is only defined in non-static member functions, not main

2015-07-29 Thread anonymous via Digitalmars-d-learn
On Wednesday, 29 July 2015 at 21:33:16 UTC, remi thebault wrote: Hello I have this weird error trying to achieve something simple: That's far from simple. Here's a reduction: template wl_container_of(alias member) { size_t get() {return member.offsetof;} } struct item { int link;

Re: extern(C) with function returning user type

2015-07-29 Thread anonymous via Digitalmars-d-learn
On Wednesday, 29 July 2015 at 17:59:26 UTC, Kyoji Klyden wrote: How would I use a C function that's returning a struct? auto doesn't work here, and from what I can tell D can't import C headers. (If it really can't then, that would be a very welcome feature) I do have the required libs but I

Re: Dynamic memory

2015-07-29 Thread anonymous via Digitalmars-d-learn
On Tuesday, 28 July 2015 at 22:52:31 UTC, Binarydepth wrote: I'm reading the reference : http://dlang.org/arrays.html And I'm declaring two dynamic arrays as I understand. What I had in mind was declaring a dynamic array of two elements each. int[2][] is exactly an dynamic array of (arrays

Re: Dynamic memory

2015-07-28 Thread anonymous via Digitalmars-d-learn
On Tuesday, 28 July 2015 at 16:41:40 UTC, Binarydepth wrote: It works with 2 as input but shows error when number is 3 :( I can't reproduce that or I misunderstood something: $ cat a.d import std.stdio : readf, writef; void main(){ int[2][] nam; int num; readf(

Re: Dynamic memory

2015-07-28 Thread anonymous via Digitalmars-d-learn
On Tuesday, 28 July 2015 at 16:09:46 UTC, Binarydepth wrote: Here is what I'm trying to do : import std.stdio : readf, writef; void main() { int[2][] nam; int num; readf( %d, num); nam.length = num; foreach(nim; 0..num){ readf( %d

Re: Select value from list, indexed by a type

2015-07-28 Thread anonymous via Digitalmars-d-learn
On Tuesday, 28 July 2015 at 21:12:13 UTC, Johan Engelen wrote: Hi all, I am wondering if there is any Phobos functionality for indexing into a list using a type. What I mean is something like: assert( somethingie!(float, float, double, real)(1, 22, 333) == 1 ); assert(

Re: Problem with casting instance reference to void* and back.

2015-07-27 Thread anonymous via Digitalmars-d-learn
On Monday, 27 July 2015 at 12:03:06 UTC, Vlad Leberstein wrote: Hi! My use case requires interaction with C API which in turn implies storing object instance reference as void *. I'm using gdc 4.9.2 and everything worked fine with object - void * - object conversion, but object - void * -

Re: Problem with casting instance reference to void* and back.

2015-07-27 Thread anonymous via Digitalmars-d-learn
On Monday, 27 July 2015 at 13:11:33 UTC, anonymous wrote: In the first example, you pass a pointer to a class instance. You cannot get the vtbl entry for the interface like this. Instead try to do this in 2 steps: actually i meant you pass an untyped pointer, so when you cast as interface

Re: Yes or No Options

2015-07-27 Thread Anonymous via Digitalmars-d-learn
On Monday, 27 July 2015 at 16:48:00 UTC, Alex wrote: Okay. By pure trying I found out what I did wrong: Apparently by typing Y I entered the shift key. Could that have been the problem? I changed it to a small y and it at least jumped back to the commandline instead of just being stuck. And

Re: Beta D 2.068.0-b2

2015-07-27 Thread anonymous via Digitalmars-d-announce
On Monday, 27 July 2015 at 23:40:28 UTC, anonymous wrote: On Monday, 27 July 2015 at 09:04:08 UTC, Martin Nowak wrote: On 07/26/2015 11:13 PM, anonymous wrote: Is std.expermimental.allocator planned for 2.068 ? I see it's still not merged and we already almost in August. We're trying hard

Re: Beta D 2.068.0-b2

2015-07-27 Thread anonymous via Digitalmars-d-announce
On Monday, 27 July 2015 at 23:49:34 UTC, anonymous wrote: On Monday, 27 July 2015 at 23:40:28 UTC, anonymous wrote: On Monday, 27 July 2015 at 09:04:08 UTC, Martin Nowak wrote: On 07/26/2015 11:13 PM, anonymous wrote: [...] We're trying hard here to meet some deadlines, so things are

Re: Why hide a trusted function as safe?

2015-07-26 Thread anonymous via Digitalmars-d-learn
On Sunday, 26 July 2015 at 11:38:31 UTC, simendsjo wrote: Is there a reason why you would hide the fact that a function is trusted rather than safe? Technically it doesn't matter, right? To me, it seems like this would give wrong assumptions to the caller. The reason I ask is because I found

Re: casting away const and then mutating

2015-07-26 Thread anonymous via Digitalmars-d
On Friday, 24 July 2015 at 21:12:57 UTC, Jonathan M Davis wrote: Well, regardless of whether mimicking inout like we're talking about with RedBlackTree should be considered defined behavior or not, I think that the spec should be updated so that the situation is clearer. It needs to be clear

Re: Beta D 2.068.0-b2

2015-07-26 Thread anonymous via Digitalmars-d-announce
On Saturday, 25 July 2015 at 12:21:19 UTC, Martin Nowak wrote: Second beta for the 2.068.0 release. Is std.expermimental.allocator planned for 2.068 ? I see it's still not merged and we already almost in August.

<    1   2   3   4   5   6   7   8   9   >