Re: crashing with no stack trace, why?

2019-01-31 Thread NX via Digitalmars-d-learn
I can't say for sure, but there are some cases I know where you don't get stack trace (mostly dmd bugs): - inside module constructors `shared static this()` - null function pointer call

Re: Converting a character to upper case in string

2018-09-21 Thread NX via Digitalmars-d-learn
On Friday, 21 September 2018 at 12:34:12 UTC, Laurent Tréguier wrote: I would probably go for std.utf.decode [1] to get the character and its length in code units, capitalize it, and concatenate the result with the rest of the string. [1] https://dlang.org/phobos/std_utf.html#.decode So by

Converting a character to upper case in string

2018-09-21 Thread NX via Digitalmars-d-learn
How can I properly convert a character, say, first one to upper case in a unicode correct manner? In which code level I should be working on? Grapheme? Or maybe code point is sufficient? There are few phobos functions like asCapitalized() none of which are what I want.

How to understand context type of a delegate?

2018-09-05 Thread NX via Digitalmars-d-learn
I was sketching some simple event-listener code and looked up std.signals module for some inspiration. Documentation says that it only works if the delegate used for slots are a class/interface member function. Digging into the code it seems like it's because _d_toObject(void*) function is

[vibe.d] How to create authentication system via REST interface?

2017-03-15 Thread NX via Digitalmars-d-learn
I'm trying to understand how to create some json-rest api that would return data (in json format) related to that specific logged in user. I see the documentation covers these but I'm totally new to vibe.d so can't quite figure out putting these two things together and make them work. Some

Re: DUB saying my Linux exe file is "not an executable file" even though DUB built it

2016-08-14 Thread NX via Digitalmars-d-learn
On Sunday, 14 August 2016 at 03:10:28 UTC, WhatMeWorry wrote: On Sunday, 14 August 2016 at 01:05:33 UTC, Basile B. wrote: On Saturday, 13 August 2016 at 21:56:49 UTC, WhatMeWorry wrote: $ sudo chmod -v 777 * mode of 'HelloWindow' changed from 0644 (rw-r--r--) to 0777 (rwxrwxrwx) $ ls -al

Re: Why D isn't the next "big thing" already

2016-07-27 Thread NX via Digitalmars-d-learn
Lack of production quality tools Lack of good marketing Lack of man power & corporate support Lack of idiomatic D libraries These are pretty much the core of all other negative consequences. Ex: GDC is few versions behind DMD because lack of man power. If only we could break the vicious

Re: Why D isn't the next "big thing" already

2016-07-27 Thread NX via Digitalmars-d-learn
On Wednesday, 27 July 2016 at 09:28:49 UTC, chmike wrote: The reason I'm switching to Go is because 3. GC performance (no stop the world hiccups) IIRC, there is a concurrent GC implementation used by sociomantic but it's linux only. (It uses fork() sys call) 4. Web server && IO performance

Re: Using external libraries the correct way

2016-07-17 Thread NX via Digitalmars-d-learn
On Sunday, 17 July 2016 at 17:52:59 UTC, solidstate1991 wrote: Up to this day, I have to use them by dragging the source into my project. When I tried to import imageformats, the compiler looks up for the file imageformats.d and fails to finish the program. I'm not using command line for

Re: Passing a sting as 'in char[]' yields "immutable is not callable using argument types ()"

2016-06-08 Thread NX via Digitalmars-d-learn
String is an alias for 'immutable(char)[]'. I assume you meant const(char)[] instead of 'const string'? P.S. always use parentheses.

Re: Things that keep D from evolving?

2016-02-09 Thread NX via Digitalmars-d-learn
On Monday, 8 February 2016 at 17:51:02 UTC, Ola Fosheim Grøstad wrote: C++ compilers have lots of optional warnings/errors, so it is quite possible. But I suppose those that want it would rather use Go, C# or some other GC language than can do ahead of time compilation. There are several

Re: Things that keep D from evolving?

2016-02-09 Thread NX via Digitalmars-d-learn
On Monday, 8 February 2016 at 22:21:50 UTC, Laeeth Isharc wrote: The GC itself may still be far from perfect but its much better than it was, and there are more options now. I have found emsi containers (built on top of Andrei's allocator) pretty nice myself for my own use. Well, GC being

Re: Things that keep D from evolving?

2016-02-09 Thread NX via Digitalmars-d-learn
On Tuesday, 9 February 2016 at 14:35:48 UTC, Ola Fosheim Grøstad wrote: Not incredibly high level abstraction... But I get what you mean. It is fairly high level for a low level language. Coming from C#, it looks amazing but probably not that incredible when coming from C++. So you want

Re: Things that keep D from evolving?

2016-02-08 Thread NX via Digitalmars-d-learn
On Monday, 8 February 2016 at 11:22:45 UTC, thedeemon wrote: On Saturday, 6 February 2016 at 08:07:42 UTC, NX wrote: What language semantics prevent precise & fast GC implementations? Unions and easy type casting prevent precise GC. Lack of write barriers for reference-type fields prevent

Re: Things that keep D from evolving?

2016-02-06 Thread NX via Digitalmars-d-learn
On Saturday, 6 February 2016 at 10:29:32 UTC, Ola Fosheim Grøstad wrote: What makes it impossible to have ref counted classes? Nothing. Then why do we need DIP74 ? And why documentation says RefCounted doesn't work with classes?

Things that keep D from evolving?

2016-02-06 Thread NX via Digitalmars-d-learn
So I came here to ask about things that prevent D to become better. What language semantics prevent precise & fast GC implementations? What makes it impossible to have ref counted classes? What are some other technical / design problems you encountered? (other than poor implementation and

Re: Determine type of property

2016-02-02 Thread NX via Digitalmars-d-learn
On Tuesday, 2 February 2016 at 03:36:25 UTC, Steven Schveighoffer wrote: int y() { return 1;} No need for meta-programming hackery, mark it as @property: int y() @property { return 1;}

Re: Collapsing n-dimensional array to linear (1 dimensional)

2016-01-22 Thread NX via Digitalmars-d-learn
On Friday, 22 January 2016 at 12:07:11 UTC, abad wrote: Let's say I have an array like this: int[][][] array; And I want to generate a linear int[] based on its data. Is there a standard library method for achieving this, or must I iterate over the array manually? What I'm thinking of is

Regression vs Bug

2016-01-14 Thread NX via Digitalmars-d-learn
Please explain.

Which GDC to download?

2015-10-01 Thread NX via Digitalmars-d-learn
Windows X86 64bit (x86_64-w64-mingw32) Standard builds Target DMDFE Runtime GCC GDC revisionBuild Date arm-linux-gnueabi 2.066.1 yes 5.2.0 dadb5a3784 2015-08-30 arm-linux-gnueabihf 2.066.1 yes 5.2.0 dadb5a3784

Re: Which GDC to download?

2015-10-01 Thread NX via Digitalmars-d-learn
Thanks both to you for answers... On Thursday, 1 October 2015 at 14:07:02 UTC, Johannes Pfau wrote: Unfortunately Windows GDC builds are very unstable right now. I'd recommend using DMD or LDC for Windows. Well... To me it's surprising GDC is not usable on windows but I doubt LDC is more

Re: Get AA key and value type

2015-09-20 Thread NX via Digitalmars-d-learn
On Saturday, 19 September 2015 at 18:13:09 UTC, Marc Schütz wrote: You can also do it with built-in syntax: template AATypes(AA : K[V], K, V) { alias Key = K; alias Value = V; } K[V] supposed to be V[K] btw...

What kind of sorcery is that?

2015-09-16 Thread NX via Digitalmars-d-learn
import std.stdio; void main() { Stuff!(Thing!float) s; writeln(typeid(s.var)); writeln(typeid(s.var.varling)); writeln(typeid(s)); } class Stuff(T) { T!int var; } class Thing(T) { T varling; }

Re: Speeding up text file parser (BLAST tabular format)

2015-09-14 Thread NX via Digitalmars-d-learn
On Monday, 14 September 2015 at 16:33:23 UTC, Rikki Cattermole wrote: A lot of this hasn't been covered I believe. http://dpaste.dzfl.pl/f7ab2915c3e1 I believe that should be: foreach (query, ref value; hitlists) Since an assignment happenin there..?

Re: Multidimension AA's and remove

2015-09-12 Thread NX via Digitalmars-d-learn
On Saturday, 12 September 2015 at 05:54:13 UTC, NX wrote: import std.stdio : writeln, std.algorithm.mutation : remove; Ooops, this is so wrong! Corrected version: void main() { import std.stdio : writeln; import std.algorithm.mutation : remove; int[][string]

Re: Difference between back (`) and double (") quoted strings

2015-09-12 Thread NX via Digitalmars-d-learn
On Saturday, 12 September 2015 at 08:13:33 UTC, Bahman Movaqar wrote: Is there any or they are just simply syntactically equivalent? Are there any official docs on this? What if I told you, you should search the official reference before asking such things in the forum?

Huge output size for simple programs

2015-09-11 Thread NX via Digitalmars-d-learn
I compile a simple hello world program in C and the results: hello_world.o -> 1.5 KB hello_world (linux executable) -> 8.5 KB Then I compile a simple hello world program in D (using DMD) and the results: hello_world.o -> 9.3 KB hello_world (linux executable) -> 575.9 KB Then I compile a

Re: Multidimension AA's and remove

2015-09-11 Thread NX via Digitalmars-d-learn
On Saturday, 12 September 2015 at 03:44:50 UTC, Prudence wrote: At the very least: Is T[][S] an associative array with keys of type S and values of an array of type T or is it backwards? Also, how to disambiguate Thanks. Indeed. void main() { import std.stdio : writeln,

Re: Huge output size for simple programs

2015-09-11 Thread NX via Digitalmars-d-learn
On Friday, 11 September 2015 at 13:45:03 UTC, Adam D. Ruppe wrote: Just D's isn't preinstalled so it carries what it needs with the executable for broadest compatibility. You could dynamically link if you like (`-defaultlib=libphobos2.so` on dmd linux) So I did some testing: # dmd

Re: Windows Header consts

2015-09-08 Thread NX via Digitalmars-d-learn
On Tuesday, 8 September 2015 at 17:22:44 UTC, NX wrote: I have figure out typo: ...I had to figure out...

Re: Windows Header consts

2015-09-08 Thread NX via Digitalmars-d-learn
On Monday, 7 September 2015 at 19:06:48 UTC, Prudence wrote: It's called encapsulation. Do you have any idea how much I struggled when I try to use enums in OpenTK library because they were "encapsulated" ? Whenever I read OpenGL tutorials I have figure out which enum-name they used as

Re: Static arrays inside struct and class - bug?

2015-08-01 Thread NX via Digitalmars-d-learn
Typo: *scenario

Static arrays inside struct and class - bug?

2015-08-01 Thread NX via Digitalmars-d-learn
I wonder if the followings are compiler bugs: class stuff_class { byte[1024*1024*16] arr; // Error: index 16777216 overflow for static array } struct stuff { byte[1024*1024*16] arr; // Error: index 16777216 overflow for static array } My project has just stopped for this reason, I

Re: Static arrays inside struct and class - bug?

2015-08-01 Thread NX via Digitalmars-d-learn
On Saturday, 1 August 2015 at 17:29:54 UTC, Adam D. Ruppe wrote: On Saturday, 1 August 2015 at 17:22:40 UTC, NX wrote: I wonder if the followings are compiler bugs: No, it is by design, the idea is to keep static arrays smallish so null references will be caught by the processor. (An overly

Re: Static arrays inside struct and class - bug?

2015-08-01 Thread NX via Digitalmars-d-learn
On Saturday, 1 August 2015 at 18:47:00 UTC, Daniel Kozak wrote: Still same problem, You can`t allocate more then 16M on stack. Use dynamic allocation I don't think new MyStruct allocates on stack, actually allocating ~16MB on stack will immediatelly crash the program which is not the case

Re: Static arrays inside struct and class - bug?

2015-08-01 Thread NX via Digitalmars-d-learn
On Saturday, 1 August 2015 at 18:50:09 UTC, Daniel Kozak wrote: No you don't. You still use static allocation for array Can clarify why does that happen and I still suspect it's a static allocation it would increase output exe if it was really that static..?

Re: Static arrays inside struct and class - bug?

2015-08-01 Thread NX via Digitalmars-d-learn
On Saturday, 1 August 2015 at 19:33:26 UTC, Daniel Kozak wrote: My fault It is not on stack, but still it is a static allocation I think you're misusing static allocation and static declaration for each other.