[your code here]

2016-12-01 Thread ringo starr via Digitalmars-d
swello.edu

Re: Contribution to cover C++11 functionality

2016-12-01 Thread Joseph Rushton Wakeling via Digitalmars-d
On Wednesday, 30 November 2016 at 21:12:16 UTC, Ilya Yaroshenko wrote: "random distribution" is like "accidental distribution". Not really. I would use "randomly chosen distribution" for that. "random variable" is much more frequently used definition is stats world (stats world != stats

Re: Contribution to cover C++11 functionality

2016-12-01 Thread Jethro via Digitalmars-d
On Thursday, 1 December 2016 at 13:42:32 UTC, Joseph Rushton Wakeling wrote: On Wednesday, 30 November 2016 at 21:12:16 UTC, Ilya Yaroshenko wrote: [...] Not really. I would use "randomly chosen distribution" for that. [...] There is a problem with `distribution` in that it also has

Re: OT: for (;;) {} vs while (true) {}

2016-12-01 Thread Nick Sabalausky via Digitalmars-d
On 11/24/2016 05:09 PM, Dennis Ritchie wrote: On Thursday, 24 November 2016 at 22:04:00 UTC, LiNbO3 wrote: As you can see [1] the `while (true)` is lowered into `for (;true;)` so it's all about what construct pleases you the most. [1]

Re: Contribution to cover C++11 functionality

2016-12-01 Thread Joseph Rushton Wakeling via Digitalmars-d
On Thursday, 1 December 2016 at 15:28:28 UTC, Jethro wrote: There is a problem with `distribution` in that it also has other meanings. Yes, but in context, is `random distribution` actually ambiguous? What might people confuse it with? `Random variable` is pretty well established But is

Re: CTFE Status

2016-12-01 Thread Stefan Koch via Digitalmars-d
I just fixed a bug cause the non-debug build to fail on a expression that it should have bailed out on. Currently I have troubles with this code : int fn(int y) { int x = void; ++x; return x+y; } Since x is uninitialized the ctfe interpreter should fail on it. I will need to reserve a

Re: OT: for (;;) {} vs while (true) {}

2016-12-01 Thread H. S. Teoh via Digitalmars-d
On Thu, Dec 01, 2016 at 11:23:26AM -0500, Nick Sabalausky via Digitalmars-d wrote: > On 11/24/2016 05:09 PM, Dennis Ritchie wrote: [...] > > The next question is: > > What principles guided when choosing between `for (;;) { ... }` and > > `while (true) { ... }` ? > > Personal preference. Nothing

Delegates: Print 0..9

2016-12-01 Thread unDEFER via Digitalmars-d-learn
Hello! Simple using of delegates: === #!/usr/bin/rdmd import std.stdio; void main() { void delegate() functions[]; foreach (i; 0..10) { void print() { writefln("%s", i); } functions ~= } foreach (i; 0..10) {

Re: how to catch D Throwables (or exceptions) from C++?

2016-12-01 Thread Rémy Mouëza via Digitalmars-d-learn
On Thursday, 1 December 2016 at 01:58:13 UTC, Timothee Cour wrote: eg: ``` dlib.d: extern(C) void dfun(){assert(0, "some_msg");} clib.cpp: extern "C" void dfun(); void fun(){ try{ dfun(); } catch(...){ // works but how do i get "some_msg" thrown from D? } } ``` I had the a

Re: Delegates: Print 0..9

2016-12-01 Thread unDEFER via Digitalmars-d-learn
Yes, I have found: = #!/usr/bin/rdmd import std.stdio; void main() { void delegate() functions[]; foreach (i; 0..10) { auto get_print(int i) { void print() { writefln("%s", i); }

Re: Delegates: Print 0..9

2016-12-01 Thread Ali Çehreli via Digitalmars-d-learn
On 12/01/2016 11:28 AM, unDEFER wrote: > Hello! > Simple using of delegates: > > === > #!/usr/bin/rdmd > import std.stdio; > > void main() > { > void delegate() functions[]; > > foreach (i; 0..10) > { > void print() > { > writefln("%s", i); >

Re: How to serialize a double.

2016-12-01 Thread Jake Pittis via Digitalmars-d-learn
On Thursday, 1 December 2016 at 07:13:45 UTC, Bauss wrote: On Thursday, 1 December 2016 at 00:36:30 UTC, Jake Pittis wrote: [...] You could do something like below which will allow you to serialize any number. import std.stdio : writeln; import std.traits : isNumeric; ubyte[]

Re: Joe Duffy on concurrency

2016-12-01 Thread Dicebot via Digitalmars-d
On Thursday, 1 December 2016 at 19:14:51 UTC, Dicebot wrote: On Thursday, 1 December 2016 at 18:56:36 UTC, qznc wrote: That is an interesting idea. Afaik, D does not allow to limit closure like this? void i_only_accept_immutable_context (void delegate () immutable closure); NB: it may have

Re: Joe Duffy on concurrency

2016-12-01 Thread Meta via Digitalmars-d
On Thursday, 1 December 2016 at 18:56:36 UTC, qznc wrote: On Thursday, 1 December 2016 at 12:17:46 UTC, Barry wrote: http://joeduffyblog.com/2016/11/30/15-years-of-concurrency/ delegate void PureFunc() immutable; This meant that a lambda conforming to the PureFunc interface could only

Re: Joe Duffy on concurrency

2016-12-01 Thread qznc via Digitalmars-d
On Thursday, 1 December 2016 at 12:17:46 UTC, Barry wrote: http://joeduffyblog.com/2016/11/30/15-years-of-concurrency/ delegate void PureFunc() immutable; This meant that a lambda conforming to the PureFunc interface could only close over immutable state. Notice how powerful this has

Re: Joe Duffy on concurrency

2016-12-01 Thread Dicebot via Digitalmars-d
On Thursday, 1 December 2016 at 18:56:36 UTC, qznc wrote: That is an interesting idea. Afaik, D does not allow to limit closure like this? void i_only_accept_immutable_context (void delegate () immutable closure);

Re: OT: for (;;) {} vs while (true) {}

2016-12-01 Thread Meta via Digitalmars-d
On Friday, 25 November 2016 at 15:29:31 UTC, Adam D. Ruppe wrote: On Friday, 25 November 2016 at 15:03:26 UTC, Andrei Alexandrescu wrote: We need to change the range API then. -- Andrei That's absurd, popFront is in no way semantically a property, so it should not get @property. It has

Re: Inline aggregate types

2016-12-01 Thread Andrei Alexandrescu via Digitalmars-d
On 12/01/2016 03:31 PM, Ethan Watson wrote: I'm binding to C++ objects where the meaningful default values require those packed values to have initial values. It's rather painful to get that working with the Phobos implementation. The simplest way to go here is to accept an initializer for the

Re: OT: for (;;) {} vs while (true) {}

2016-12-01 Thread Jonathan M Davis via Digitalmars-d
On Thursday, December 01, 2016 19:25:27 Meta via Digitalmars-d wrote: > On Friday, 25 November 2016 at 15:29:31 UTC, Adam D. Ruppe wrote: > > On Friday, 25 November 2016 at 15:03:26 UTC, Andrei > > > > Alexandrescu wrote: > >> We need to change the range API then. -- Andrei > > > > That's absurd,

Re: Inline aggregate types

2016-12-01 Thread Ethan Watson via Digitalmars-d
On Thursday, 1 December 2016 at 20:57:13 UTC, Andrei Alexandrescu wrote: The simplest way to go here is to accept an initializer for the entire ubyte/ushort/uint/ulong underlying the bitfields. -- Andrei In terms of efficiency at compile time, indeed. But there's multiple paths there. You

The module 'foo' is already defined in 'libmylib.so'

2016-12-01 Thread Timothee Cour via Digitalmars-d-learn
I want to update a library with new symbols (ie partial recompilation): libmylib.so : compiled from bar.d and foo.d now update the file foo.d dmd -c -fPIC foo.d -offoo.o clang++ -o libmylib_update.so foo.o -shared -Wl,-lmylib When trying to dlopen libmylib_update.so from C++ it fails with:

Inline aggregate types

2016-12-01 Thread Ethan Watson via Digitalmars-d
https://github.com/Remedy-Entertainment/binderoo/blob/master/binderoo_client/d/src/binderoo/bitpacking.d So I've been not-all-that-pleased with std.bitmanip.bitfields for a while. It's nice that it's there, but I'm binding to C++ objects where the meaningful default values require those packed

Re: Inline aggregate types

2016-12-01 Thread ag0aep6g via Digitalmars-d
On 12/01/2016 09:31 PM, Ethan Watson wrote: I'm also sure there's plenty of other legit uses for inline aggregate types. So while the feature doesn't exist in the language yet, at least you can now see that there's quite a legit hacky-as-all-fuck workaround for it. Interestingly, we do have

Re: Inline aggregate types

2016-12-01 Thread H. S. Teoh via Digitalmars-d
On Thu, Dec 01, 2016 at 08:31:32PM +, Ethan Watson via Digitalmars-d wrote: [...] > So the invokation, while not as readable, looks like: > > mixin BitPack!( "@PackSize( 3 ) int iSomeInt = 3; @PackSize( 1 ) bool > bSomeBool = true; @PackSize( 4 ) int iSomeOtherInt;" ); > > I'm sure I just

Re: Inline aggregate types

2016-12-01 Thread Ethan Watson via Digitalmars-d
On Thursday, 1 December 2016 at 20:31:32 UTC, Ethan Watson wrote: https://github.com/Remedy-Entertainment/binderoo/blob/master/binderoo_client/d/src/binderoo/bitpacking.d Stefan also reminded me that this would be a perfect spot where __symbol CTFE variables would make life much easier

Re: Inline aggregate types

2016-12-01 Thread Ethan Watson via Digitalmars-d
On Thursday, 1 December 2016 at 20:58:53 UTC, H. S. Teoh wrote: In cases like these, q{} comes to the rescue: I had precisely zero idea this existed.

Re: [your code here]

2016-12-01 Thread Sameer Pradhan via Digitalmars-d
On Thursday, 1 December 2016 at 14:26:11 UTC, ringo starr wrote: swello.edu This post screams Captcha! Just to make sure it was not a false positive, I went to the (non-existent) URL. On the bright side, the forum seems to be widely circulated—enough to attract spammers! As far as I can

Re: Two part question. Making a dynamic array of delegates, and taking in a delegate with unknown parameters as an argument .

2016-12-01 Thread Nicholas Wilson via Digitalmars-d-learn
On Thursday, 1 December 2016 at 23:51:19 UTC, Payotz wrote: So, to give context, I am trying to make an event manager for a game I'm making. I was writing the "register()" method so I ran into a problem. The register method will take in delegates as an argument, but those delegates have

Re: Two part question. Making a dynamic array of delegates, and taking in a delegate with unknown parameters as an argument .

2016-12-01 Thread Mike Parker via Digitalmars-d-learn
On Thursday, 1 December 2016 at 23:51:19 UTC, Payotz wrote: The register method will take in delegates as an argument, but those delegates have varied arguments themselves, so I can't really put anything there. I know that it's got something to do with templates so I tried my hand in it and

Re: The module 'foo' is already defined in 'libmylib.so'

2016-12-01 Thread Nicholas Wilson via Digitalmars-d-learn
On Thursday, 1 December 2016 at 22:05:06 UTC, Timothee Cour wrote: I want to update a library with new symbols (ie partial recompilation): libmylib.so : compiled from bar.d and foo.d now update the file foo.d dmd -c -fPIC foo.d -offoo.o clang++ -o libmylib_update.so foo.o -shared

Re: Two part question. Making a dynamic array of delegates, and taking in a delegate with unknown parameters as an argument .

2016-12-01 Thread H. S. Teoh via Digitalmars-d-learn
On Thu, Dec 01, 2016 at 11:51:19PM +, Payotz via Digitalmars-d-learn wrote: > So, to give context, I am trying to make an event manager for a game > I'm making. > I was writing the "register()" method so I ran into a problem. > > The register method will take in delegates as an argument, but

Re: Two part question. Making a dynamic array of delegates, and taking in a delegate with unknown parameters as an argument .

2016-12-01 Thread Payotz via Digitalmars-d-learn
Thank you all for the replies. I'm extremely grateful. I'll look into each and every answer.

Two part question. Making a dynamic array of delegates, and taking in a delegate with unknown parameters as an argument .

2016-12-01 Thread Payotz via Digitalmars-d-learn
So, to give context, I am trying to make an event manager for a game I'm making. I was writing the "register()" method so I ran into a problem. The register method will take in delegates as an argument, but those delegates have varied arguments themselves, so I can't really put anything

Re: Two part question. Making a dynamic array of delegates, and taking in a delegate with unknown parameters as an argument .

2016-12-01 Thread Ali Çehreli via Digitalmars-d-learn
On 12/01/2016 03:51 PM, Payotz wrote: > So, to give context, I am trying to make an event manager for a game I'm > making. > I was writing the "register()" method so I ran into a problem. > > The register method will take in delegates as an argument, but those > delegates have varied arguments

Re: Two part question. Making a dynamic array of delegates, and taking in a delegate with unknown parameters as an argument .

2016-12-01 Thread crimaniak via Digitalmars-d-learn
On Thursday, 1 December 2016 at 23:51:19 UTC, Payotz wrote: So, to give context, I am trying to make an event manager for a game I'm making. I was writing the "register()" method so I ran into a problem. The register method will take in delegates as an argument, but those delegates have

[Issue 16885] Cannot deduce function from argument type when mixing template instantiation and implicit convertion

2016-12-01 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=16885 uplink.co...@googlemail.com changed: What|Removed |Added CC||uplink.co...@googlemail.com

Re: Delegates: Print 0..9

2016-12-01 Thread unDEFER via Digitalmars-d-learn
On Thursday, 1 December 2016 at 20:12:15 UTC, Ali Çehreli wrote: First, the scary syntax that produces a lambda from an int: ... Better: ... All methods.. Thank you!

Spam

2016-12-01 Thread Walter Bright via Digitalmars-d
Please do not respond to spam posts.

Joe Duffy on concurrency

2016-12-01 Thread Barry via Digitalmars-d
http://joeduffyblog.com/2016/11/30/15-years-of-concurrency/ D gets a brief, but good plug: D The system we came up with has obvious comparisons to D’s take on const and immutable; just as D’s const is a view over mutable or immutable data, so too is our readonly. And just as D added deepness

Re: Release D 2.072.1

2016-12-01 Thread Márcio Martins via Digitalmars-d-announce
On Thursday, 1 December 2016 at 12:36:35 UTC, Gary Willoughby wrote: On Wednesday, 30 November 2016 at 22:49:12 UTC, Martin Nowak wrote: Glad to announce D 2.072.1. http://dlang.org/download.html This point release fixes a few issues over 2.072.0, see the changelog for more details.

Re: Release D 2.072.1

2016-12-01 Thread Gary Willoughby via Digitalmars-d-announce
On Wednesday, 30 November 2016 at 22:49:12 UTC, Martin Nowak wrote: Glad to announce D 2.072.1. http://dlang.org/download.html This point release fixes a few issues over 2.072.0, see the changelog for more details. http://dlang.org/changelog/2.072.1.html -Martin The download page doesn't

[Issue 15935] compiling dub with -fPIC triggers internal compiler error

2016-12-01 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=15935 --- Comment #2 from Martin Krejcirik --- (In reply to Jonathan M Davis from comment #1) > The same thing happens when compiling druntime with PIC=1 on the latest What DMD version ? Also see issue 16031. --

[Issue 16885] New: Cannot deduce function from argument type when mixing template instantiation and implicit convertion

2016-12-01 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=16885 Issue ID: 16885 Summary: Cannot deduce function from argument type when mixing template instantiation and implicit convertion Product: D Version: D2 Hardware: All

Programming Atmega8 with AVRISP mkII Error ispProgramMem

2016-12-01 Thread zoezz via Digitalmars-d
If I go to Tools > Device Programming in AVRStudio 6.0 to program the Atmega8(http://www.kynix.com/uploadfiles/pdf/ATMEGA8L-8AU.pdf) everything is working fine. I've set the ISP frequency to 1 MHz and checked the fuses as well. But as I just hit F5, programming most of the times failes

[Issue 16914] Add -mavx switch to generate AVX instructions instead of SSE instructions

2016-12-01 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=16914 --- Comment #1 from Walter Bright --- A start: https://github.com/dlang/dmd/pull/6293 --

[Issue 16914] New: Add -mavx switch to generate AVX instructions instead of SSE instructions

2016-12-01 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=16914 Issue ID: 16914 Summary: Add -mavx switch to generate AVX instructions instead of SSE instructions Product: D Version: D2 Hardware: All OS: All

[Issue 16914] Add -mavx switch to generate AVX instructions instead of SSE instructions

2016-12-01 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=16914 Walter Bright changed: What|Removed |Added Keywords||SIMD --

Re: [your code here]

2016-12-01 Thread Era Scarecrow via Digitalmars-d
On Thursday, 1 December 2016 at 21:37:10 UTC, Sameer Pradhan wrote: On Thursday, 1 December 2016 at 14:26:11 UTC, ringo starr wrote: swello.edu This post screams Captcha! Just to make sure it was not a false positive, I went to the (non-existent) URL. On the bright side, the forum seems to