Re: Struct List Human

2017-09-24 Thread dark777 via Digitalmars-d-learn
On Sunday, 24 September 2017 at 15:51:01 UTC, dark777 wrote: On Sunday, 24 September 2017 at 15:22:30 UTC, Suliman wrote: On Sunday, 24 September 2017 at 14:32:14 UTC, dark777 wrote: I have the following code: https://pastebin.com/PWuaXJNp but typing my name does not go to the next line as

Re: Is it possible to avoid call to destructor for structs?

2017-09-24 Thread bitwise via Digitalmars-d-learn
On Sunday, 24 September 2017 at 17:11:26 UTC, Haridas wrote: In the following code, Bar is an element of struct Foo. Is there a way to avoid a call to ~Bar when ~Foo is getting executed? Don't construct it to begin with. struct Bar { import std.stdio : writeln; int a = 123;

asm.dlang.org needs newer DMD versions

2017-09-24 Thread Johan Engelen via Digitalmars-d
http://asm.dlang.org/ does not have DMD 2.072, 2.073, 2.074, 2.075, nor 2.076. Thanks for updating the site. Cheers, Johan

Is it possible to avoid call to destructor for structs?

2017-09-24 Thread Haridas via Digitalmars-d-learn
In the following code, Bar is an element of struct Foo. Is there a way to avoid a call to ~Bar when ~Foo is getting executed? // >> import std.stdio; struct Foo { Bar bar; ~this() { writeln("~Foo"); // some code that disables call to ~Bar } } struct Bar { ~this() {

Re: Struct List Human

2017-09-24 Thread Adam D. Ruppe via Digitalmars-d-learn
I think readf("%s") reads everything available. readf(" %s\n") might help but personally, I say avoid readf. Just use readln and to!int instead auto line = readln(); if(line.length == 0) writeln("please enter a number"); age = to!int(line); to is from import std.conv

Re: 100,000th thread on the NG

2017-09-24 Thread bitwise via Digitalmars-d
On Sunday, 24 September 2017 at 04:24:55 UTC, user1234 wrote: This is the 100,000th Thread. https://m.popkey.co/61642c/WxA4D.gif

Re: Is it possible to avoid call to destructor for structs?

2017-09-24 Thread Adam D. Ruppe via Digitalmars-d-learn
On Sunday, 24 September 2017 at 17:11:26 UTC, Haridas wrote: In the following code, Bar is an element of struct Foo. Is there a way to avoid a call to ~Bar when ~Foo is getting executed? No, but you could just set a flag in Bar that the destructor checks and skips running if it is set. In

Re: Struct List Human

2017-09-24 Thread dark777 via Digitalmars-d-learn
On Sunday, 24 September 2017 at 17:05:11 UTC, Neia Neutuladh wrote: On Sunday, 24 September 2017 at 16:13:30 UTC, dark777 wrote: when you execute and call Name: I type my name: Name: dark777 + [enter] and he does not jump to the next line to get the age This is what I want to know how to

Re: Struct List Human

2017-09-24 Thread dark777 via Digitalmars-d-learn
On Sunday, 24 September 2017 at 15:22:30 UTC, Suliman wrote: On Sunday, 24 September 2017 at 14:32:14 UTC, dark777 wrote: I have the following code: https://pastebin.com/PWuaXJNp but typing my name does not go to the next line as soon as I press enter how to solve this? use writeln instead

Re: Struct List Human

2017-09-24 Thread Neia Neutuladh via Digitalmars-d-learn
On Sunday, 24 September 2017 at 16:13:30 UTC, dark777 wrote: when you execute and call Name: I type my name: Name: dark777 + [enter] and he does not jump to the next line to get the age This is what I want to know how to solve. Add a `writeln();` after reading input, maybe?

Re: Simple web server benchmark - vibe.d is slower than node.js and Go?

2017-09-24 Thread Vadim Lopatin via Digitalmars-d
On Friday, 22 September 2017 at 09:40:00 UTC, Sönke Ludwig wrote: What's was the last status? Could you observe any meaningful thread scaling? It works for me - multithreading improves performance on my PC. So far, test results on https://github.com/nuald/simple-web-benchmark show that D is

Re: Is it possible to avoid call to destructor for structs?

2017-09-24 Thread Haridas via Digitalmars-d-learn
Also consider the following code. Please let me know if I am doing the right thing for dynamic arrays. My hack seems to have the desired effect on shutting down the destructor. Is this hack legal use of D? Can you please guide me if/how it can be achieved for std.container.Array? //

Re: Struct List Human

2017-09-24 Thread dark777 via Digitalmars-d-learn
On Sunday, 24 September 2017 at 18:00:32 UTC, Adam D. Ruppe wrote: I think readf("%s") reads everything available. readf(" %s\n") might help but personally, I say avoid readf. Just use readln and to!int instead auto line = readln(); if(line.length == 0) writeln("please enter a number");

Re: Is it possible to avoid call to destructor for structs?

2017-09-24 Thread Biotronic via Digitalmars-d-learn
On Sunday, 24 September 2017 at 18:46:15 UTC, Haridas wrote: Also consider the following code. Please let me know if I am doing the right thing for dynamic arrays. My hack seems to have the desired effect on shutting down the destructor. Is this hack legal use of D? Can you please guide me

Re: Simple web server benchmark - vibe.d is slower than node.js and Go?

2017-09-24 Thread bitwise via Digitalmars-d
On Sunday, 24 September 2017 at 08:08:35 UTC, Petar Kirov [ZombineDev] wrote: On Saturday, 23 September 2017 at 22:07:58 UTC, bitwise wrote: [...] Can you give a bit more details? What kind of architectures do you mean (hardware, software, ..)? What was your use case? IO-multiplexing,

Re: Is it possible to avoid call to destructor for structs?

2017-09-24 Thread Haridas via Digitalmars-d-learn
Thanks Adam Actually Bar's API and implementation is not in my control. Consider the scenario where it is implemented in a library. Or a scenario where I have millions of instances of Bar (not necessarily as a component of Foo) and I do not want to add to runtime memory footprint. Ok,

Re: Should we add `a * b` for vectors?

2017-09-24 Thread Mark via Digitalmars-d
On Friday, 22 September 2017 at 17:11:56 UTC, Ilya Yaroshenko wrote: Should we add `a * b` to ndslice for 1d vectors? Discussion at https://github.com/libmir/mir-algorithm/issues/91 Generally I expect that a binary operation denoted by + or * would produce an element from the original domain,

Re: Struct alignment

2017-09-24 Thread EntangledQuanta via Digitalmars-d
On Sunday, 24 September 2017 at 21:01:06 UTC, Johan Engelen wrote: DMD <= 2.074 and DMD >= 2.075 disagree on struct alignment. ``` struct UInt { align(1): uint a; } struct Bug { ubyte one; UInt two; } static assert(Bug.two.offsetof == 4); // Error DMD>=2.075, 1 == 4 is false

Struct alignment

2017-09-24 Thread Johan Engelen via Digitalmars-d
DMD <= 2.074 and DMD >= 2.075 disagree on struct alignment. ``` struct UInt { align(1): uint a; } struct Bug { ubyte one; UInt two; } static assert(Bug.two.offsetof == 4); // Error DMD>=2.075, 1 == 4 is false static assert(Bug.sizeof == 8); // Error DMD>=2.075, 5 == 8 is false

Re: Is it possible to avoid call to destructor for structs?

2017-09-24 Thread bitwise via Digitalmars-d-learn
On Monday, 25 September 2017 at 01:46:15 UTC, Haridas wrote: [...] It all works well so far. But as soon as I create an instance of Bar inside a Dlang class (say Foo) or as part of a Dlang dynamic array, hell follows. At some point, Dlang's GC kicks in and Bar's destructor gets called from

Re: Struct alignment

2017-09-24 Thread Johan Engelen via Digitalmars-d
On Sunday, 24 September 2017 at 21:21:27 UTC, kinke wrote: On Sunday, 24 September 2017 at 21:01:06 UTC, Johan Engelen wrote: So... what's correct? :-) 2.075+. ;) See https://github.com/dlang/dmd/pull/6754. Thanks kinke. (now on to fix LDC's codegen ;-)

Re: asm.dlang.org needs newer DMD versions

2017-09-24 Thread Iain Buclaw via Digitalmars-d
On 24 September 2017 at 22:10, Johan Engelen via Digitalmars-d wrote: > http://asm.dlang.org/ does not have DMD 2.072, 2.073, 2.074, 2.075, nor > 2.076. > Thanks for updating the site. > > Cheers, > Johan > I'll have a look at it possibly tomorrow. Iain.

Re: Struct alignment

2017-09-24 Thread kinke via Digitalmars-d
On Sunday, 24 September 2017 at 21:01:06 UTC, Johan Engelen wrote: So... what's correct? :-) 2.075+. ;) See https://github.com/dlang/dmd/pull/6754.

Re: Should we add `a * b` for vectors?

2017-09-24 Thread Nicholas Wilson via Digitalmars-d
On Sunday, 24 September 2017 at 23:59:59 UTC, jmh530 wrote: On Sunday, 24 September 2017 at 22:33:48 UTC, H. S. Teoh wrote: With UFCS, you have the slightly nicer notation a.dot(b) and a.cross(b). T Below is a link to the operators in Matlab and associated functions. mir can include all

Re: Is it possible to avoid call to destructor for structs?

2017-09-24 Thread Haridas via Digitalmars-d-learn
In general, of course, this is a bad idea - there's probably a reason that destructor does the thing it's doing. If you're sure skipping it is what you want, go ahead. @Biotronic, the code you have provided may be exactly what I am looking for. Let me explain my situation. I have a library

Re: Simple web server benchmark - vibe.d is slower than node.js and Go?

2017-09-24 Thread Arun Chandrasekaran via Digitalmars-d
On Sunday, 24 September 2017 at 18:36:50 UTC, Vadim Lopatin wrote: On Friday, 22 September 2017 at 09:40:00 UTC, Sönke Ludwig wrote: What's was the last status? Could you observe any meaningful thread scaling? It works for me - multithreading improves performance on my PC. So far, test

Re: Should we add `a * b` for vectors?

2017-09-24 Thread H. S. Teoh via Digitalmars-d
On Sun, Sep 24, 2017 at 06:18:38PM +, Mark via Digitalmars-d wrote: > On Friday, 22 September 2017 at 17:11:56 UTC, Ilya Yaroshenko wrote: > > Should we add `a * b` to ndslice for 1d vectors? > > Discussion at https://github.com/libmir/mir-algorithm/issues/91 > > Generally I expect that a

Re: Should we add `a * b` for vectors?

2017-09-24 Thread jmh530 via Digitalmars-d
On Sunday, 24 September 2017 at 18:18:38 UTC, Mark wrote: Generally I expect that a binary operation denoted by + or * would produce an element from the original domain, e.g. multiplying two matrices yields a matrix, concatenating two strings yields a string, etc. So personally I don't like

Re: Should we add `a * b` for vectors?

2017-09-24 Thread jmh530 via Digitalmars-d
On Sunday, 24 September 2017 at 22:33:48 UTC, H. S. Teoh wrote: With UFCS, you have the slightly nicer notation a.dot(b) and a.cross(b). T Below is a link to the operators in Matlab and associated functions. mir can include all of those functions, but not all of them can be implemented

Re: GDC in Slackware and a bit about GDC development

2017-09-24 Thread Iain Buclaw via Digitalmars-d-announce
On 23 September 2017 at 22:55, Eugene Wissner via Digitalmars-d-announce wrote: > On Saturday, 23 September 2017 at 20:34:51 UTC, Iain Buclaw wrote: >> >> On 23 September 2017 at 21:45, Eugene Wissner via Digitalmars-d-announce >>

Re: GC operates in LIFO sequence?

2017-09-24 Thread Joseph5 via Digitalmars-d
Hmmm. Find some useful information here.

Re: Should we add `a * b` for vectors?

2017-09-24 Thread Z via Digitalmars-d
On Sunday, 24 September 2017 at 05:24:57 UTC, Manu wrote: On 23 September 2017 at 03:11, Ilya Yaroshenko via Digitalmars-d < digitalmars-d@puremagic.com> wrote: Should we add `a * b` to ndslice for 1d vectors? Discussion at https://github.com/libmir/mir-algorithm/issues/91 I often ponder

[Issue 17855] New: Forum draft, error accessing 5-month-old draft, can't dismiss banner

2017-09-24 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=17855 Issue ID: 17855 Summary: Forum draft, error accessing 5-month-old draft, can't dismiss banner Product: D Version: D2 Hardware: x86_64 OS: Linux

[Issue 17855] Forum draft, error accessing 5-month-old draft, can't dismiss banner

2017-09-24 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=17855 b2.t...@gmx.com changed: What|Removed |Added Status|NEW |RESOLVED CC|

Struct List Human

2017-09-24 Thread dark777 via Digitalmars-d-learn
I have the following code: https://pastebin.com/PWuaXJNp but typing my name does not go to the next line as soon as I press enter how to solve this?

Re: Struct List Human

2017-09-24 Thread Suliman via Digitalmars-d-learn
On Sunday, 24 September 2017 at 14:32:14 UTC, dark777 wrote: I have the following code: https://pastebin.com/PWuaXJNp but typing my name does not go to the next line as soon as I press enter how to solve this? use writeln instead write

[Issue 17855] Forum draft, error accessing 5-month-old draft, can't dismiss banner

2017-09-24 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=17855 Simon Na. changed: What|Removed |Added Severity|enhancement |normal --

Re: Simple web server benchmark - vibe.d is slower than node.js and Go?

2017-09-24 Thread Petar via Digitalmars-d
On Saturday, 23 September 2017 at 22:07:58 UTC, bitwise wrote: Of the few different architectures I tried, the fiber based approach was much slower. It's possible that my implementation did too many unnecessary context switches. Can you give a bit more details? What kind of architectures do

Re: Real beginner traits question

2017-09-24 Thread rikki cattermole via Digitalmars-d-learn
On 25/09/2017 6:28 AM, WhatMeForget wrote: This is taken exactly from the traits documentation. 25 Traits 25.21 identifier Takes one argument, a symbol. Returns the identifier for that symbol as a string literal.

Re: Simple web server benchmark - vibe.d is slower than node.js and Go?

2017-09-24 Thread Sönke Ludwig via Digitalmars-d
Am 24.09.2017 um 20:36 schrieb Vadim Lopatin: On Friday, 22 September 2017 at 09:40:00 UTC, Sönke Ludwig wrote: What's was the last status? Could you observe any meaningful thread scaling? It works for me - multithreading improves performance on my PC. So far, test results on

Re: 100,000th thread on the NG

2017-09-24 Thread user1234 via Digitalmars-d
On Sunday, 24 September 2017 at 04:24:55 UTC, user1234 wrote: This is the 100,000th Thread. A few hours ago, i was letting my mind flying. What if i were a professor. What would i tell about D... " We reach the end of this short course. Next time we'll see us you'll be tested. This test

Re: Should we add `a * b` for vectors?

2017-09-24 Thread jmh530 via Digitalmars-d
On Monday, 25 September 2017 at 01:08:35 UTC, Nicholas Wilson wrote: There's nothing stopping someone writing a DIP to include `@` (and possibly `#`) as overloadable binary operators. I actually like * for dot product and matrix multiplication... The issue is that if you use * for these,

Re: Is it possible to avoid call to destructor for structs?

2017-09-24 Thread Haridas via Digitalmars-d-learn
In your case, the postblit of Bar is still going to run and add a ref to it's count when you place it in Foo, right? That means that if you don't destroy it, it will leak memory or resources. Actually no. Since when Foo (class that instantiates Bar) gets GCed, that is the point that I need

Re: Should we add `a * b` for vectors?

2017-09-24 Thread user1234 via Digitalmars-d
On Monday, 25 September 2017 at 01:08:35 UTC, Nicholas Wilson wrote: There's nothing stopping someone writing a DIP to include `@` (and possibly `#`) as overloadable binary operators. All other characters on the standard keyboard are used I think. ̣̣§

Real beginner traits question

2017-09-24 Thread WhatMeForget via Digitalmars-d-learn
This is taken exactly from the traits documentation. 25 Traits 25.21 identifier Takes one argument, a symbol. Returns the identifier for that symbol as a string literal. There are no

Re: Should we add `a * b` for vectors?

2017-09-24 Thread Nicholas Wilson via Digitalmars-d
On Monday, 25 September 2017 at 03:22:01 UTC, user1234 wrote: On Monday, 25 September 2017 at 01:08:35 UTC, Nicholas Wilson wrote: There's nothing stopping someone writing a DIP to include `@` (and possibly `#`) as overloadable binary operators. All other characters on the standard keyboard