Re: template ctor overload Segmentation fault

2021-12-13 Thread user1234 via Digitalmars-d-learn
On Sunday, 12 December 2021 at 11:57:43 UTC, vit wrote: Hello, why does this code fail to compile? ```d struct Foo(T){ this(Rhs, this This)(scope Rhs rhs){ } this(ref scope typeof(this) rhs){ } } struct Bar{ Foo!int foo; } void main(){ } ``` error: Segmentation

Re: DQt: Qt bindings using extern(C++)

2021-12-05 Thread user1234 via Digitalmars-d-announce
On Sunday, 5 December 2021 at 12:54:21 UTC, Tim wrote: DQt contains new experimental bindings for using a subset of Qt with D. Qt is a library for writing cross-platform graphical user interfaces. Currently bindings exist for the Qt modules core, gui and widgets. The bindings use extern(C++)

Re: Debugging D code with GDB

2021-11-28 Thread user1234 via Digitalmars-d-learn
On Sunday, 28 November 2021 at 16:44:38 UTC, russhy wrote: On Sunday, 28 November 2021 at 14:53:17 UTC, user1234 wrote: ... there is a plugin to demangle things automatically https://github.com/ANtlord/gdb-ddemangle That's off-topic. The point here is that you can (unfortunately)

Re: Debugging D code with GDB

2021-11-28 Thread user1234 via Digitalmars-d-learn
On Saturday, 27 November 2021 at 14:17:11 UTC, Eduard Staniloiu wrote: Hello, I'm trying to use `gdb` to debug D binaries, but I'm having trouble accessing the methods of a struct or class. It seems that `gdb` doesn't see them. [...] Looking forward to your answers, Edi [0] -

Re: New developments on topic of memset, memcpy and similar

2021-11-27 Thread user1234 via Digitalmars-d-learn
On Saturday, 27 November 2021 at 11:15:45 UTC, Igor wrote: Two years ago there was a [Google Summer of Code project](https://forum.dlang.org/thread/izaufklyvmktnwsrm...@forum.dlang.org) to implement these primitives in pure D for various reason. It was concluded the project isn't viable and was

Re: How to get the location (file, line) of UDA without parens?

2021-11-13 Thread user1234 via Digitalmars-d-learn
On Sunday, 14 November 2021 at 05:12:58 UTC, Andrey Zherikov wrote: Here is my code: [...] `W()` (2) works as expected but is it possible to achieve the same without parenthesis so `getAttributes` trait returns `tuple(L("app.d", 16LU))` for (1)? No, without parens this is really the function

Re: The type inference everywhere

2021-10-31 Thread user1234 via Digitalmars-d-learn
On Sunday, 31 October 2021 at 17:51:45 UTC, data pulverizer wrote: On Sunday, 31 October 2021 at 17:35:35 UTC, Ali Çehreli wrote: On 10/31/21 7:07 AM, Salih Dincer wrote: > [...] because I > [...] Makes sense because e.g. the following works: struct S { auto i = 42; } I bet the problem

Re: Why do we have Dmain?

2021-10-25 Thread user1234 via Digitalmars-d-learn
On Friday, 22 October 2021 at 05:54:21 UTC, Kirill wrote: I am not a compiler expert, but I genuinely would like to know why we have Dmain. I've been looking at the generated assembly code recently and noticed the _Dmain function. I didn't notice it before. Then there is main, where Dmain is

Re: How can we allow using phobos with asserts/contracts?

2021-10-18 Thread user1234 via Digitalmars-d-learn
On Sunday, 17 October 2021 at 21:00:19 UTC, Steven Schveighoffer wrote: On 10/16/21 6:47 PM, solidstate1991 wrote: When I make this call ``` format(" %3.3f"w, avgFPS); ``` my program immediately crashes with an access violation error. The debugger out is different between x86 and x86-64.

Re: toString and code coverage...

2021-09-22 Thread user1234 via Digitalmars-d-learn
On Wednesday, 22 September 2021 at 15:27:23 UTC, wjoe wrote: Is there a convenient way to exclude it from coverage ? Because adjusting the -cov=xx percentage is kind of annoying and may omit other things as well. Do you care and if yes how do you handle it ? You have several options 1.

Re: Which operators cannot be overloaded and why not?

2021-09-13 Thread user1234 via Digitalmars-d-learn
On Monday, 13 September 2021 at 18:06:42 UTC, NonNull wrote: On Monday, 13 September 2021 at 14:42:42 UTC, jfondren wrote: On Monday, 13 September 2021 at 14:33:03 UTC, user1234 wrote: - condition al expression ` cond ? exp : exp ` And many other boolean operators, unary !, binary && and ||

Re: Program crash: GC destroys an object unexpectedly

2021-09-13 Thread user1234 via Digitalmars-d-learn
On Monday, 13 September 2021 at 17:54:43 UTC, eugene wrote: On Monday, 13 September 2021 at 17:40:41 UTC, user1234 wrote: The problems seems to lies in `newSignal()` which "would" not allocate using the GC. final Signal newSignal(int signum) { Signal sg = new Signal(signum);

Re: Program crash: GC destroys an object unexpectedly

2021-09-13 Thread user1234 via Digitalmars-d-learn
On Monday, 13 September 2021 at 17:18:30 UTC, eugene wrote: [...] At first glance and given the fact that some code necessary to diagnose the problem accurately is missing: `new Stopper` allocates using the GC. it's then a "GC range", it's content will be scanned and handled by the GC,

Re: Program crash: GC destroys an object unexpectedly

2021-09-13 Thread user1234 via Digitalmars-d-learn
On Monday, 13 September 2021 at 17:40:41 UTC, user1234 wrote: On Monday, 13 September 2021 at 17:18:30 UTC, eugene wrote: [...] At first glance and given the fact that some code necessary to diagnose the problem accurately is missing: `new Stopper` allocates using the GC. it's then a "GC

Re: Which operators cannot be overloaded and why not?

2021-09-13 Thread user1234 via Digitalmars-d-learn
On Monday, 13 September 2021 at 14:59:38 UTC, Paul Backus wrote: On Monday, 13 September 2021 at 14:42:42 UTC, jfondren wrote: On Monday, 13 September 2021 at 14:33:03 UTC, user1234 wrote: - condition al expression ` cond ? exp : exp ` And many other boolean operators, unary !, binary && and

Re: Which operators cannot be overloaded and why not?

2021-09-13 Thread user1234 via Digitalmars-d-learn
On Monday, 13 September 2021 at 15:29:05 UTC, user1234 wrote: [...] so this is a bit like the postincr case. i.e "prevent the semantics to be hijacked".

Re: Which operators cannot be overloaded and why not?

2021-09-13 Thread user1234 via Digitalmars-d-learn
On Monday, 13 September 2021 at 14:42:42 UTC, jfondren wrote: On Monday, 13 September 2021 at 14:33:03 UTC, user1234 wrote: - condition al expression ` cond ? exp : exp ` And many other boolean operators, unary !, binary && and || They are all indirectly supported if `opCast` is overloaded:

Re: Which operators cannot be overloaded and why not?

2021-09-13 Thread user1234 via Digitalmars-d-learn
On Monday, 13 September 2021 at 14:33:03 UTC, user1234 wrote: what else ? when you have ```d alias AA1 = int[int]; alias AA2 = AA1[int]; ``` then you can write ```d AA2 aa; aa[0] = [0 : 0]; aa[0][0] = 0; ``` The `[0][0]` cannot be expressed using operator overloads (and a custom map type

Re: Which operators cannot be overloaded and why not?

2021-09-13 Thread user1234 via Digitalmars-d-learn
On Monday, 13 September 2021 at 14:12:36 UTC, NonNull wrote: Which operators cannot be overloaded and why not? Let's start the list. - `new` and `delete` Because operators are overloaded in aggregates new was supported but not anymore, the idea is that a an aggregate should not be tied a

Re: Need for std.meta.isSame over __traits(isSame)

2021-09-01 Thread user1234 via Digitalmars-d-learn
On Wednesday, 1 September 2021 at 23:04:18 UTC, Per Nordlöw wrote: On Wednesday, 1 September 2021 at 22:51:40 UTC, Per Nordlöw wrote: Can somebody explain the need for Ok, `__traits(isSame)` always returns false for values. This is very unfortunate as `std.traits.isSame` is one of the most

Re: Need for std.meta.isSame over __traits(isSame)

2021-09-01 Thread user1234 via Digitalmars-d-learn
On Wednesday, 1 September 2021 at 22:51:40 UTC, Per Nordlöw wrote: Can somebody explain the need for ```d private template isSame(alias a, alias b) { static if (!is(typeof( && )) // at least one is an rvalue && __traits(compiles, { enum isSame = a == b; })) // c-t comparable

Re: SAOC 2021 Projects Summarized

2021-09-01 Thread user1234 via Digitalmars-d-announce
On Wednesday, 1 September 2021 at 18:20:59 UTC, Paul Backus wrote: On Monday, 30 August 2021 at 16:12:57 UTC, Adam D Ruppe wrote: On Monday, 30 August 2021 at 16:03:29 UTC, Guillaume Piolat wrote: Hyped by ProtoObject, this is our hope for a nothrow @nogc .destroy eventually! This fails

Re: Singleton Object, calling member functions using UFCS (an "ugly?" example) ... better way?

2021-09-01 Thread user1234 via Digitalmars-d-learn
On Wednesday, 1 September 2021 at 22:01:12 UTC, user1234 wrote: On Wednesday, 1 September 2021 at 20:59:15 UTC, james.p.leblanc wrote: [...] The question is if there is a way to enable UFCS without such wrapper sorry my attention got stuck on the singleton. So my suggestion is rather to

Re: Singleton Object, calling member functions using UFCS (an "ugly?" example) ... better way?

2021-09-01 Thread user1234 via Digitalmars-d-learn
On Wednesday, 1 September 2021 at 20:59:15 UTC, james.p.leblanc wrote: [...] The question is if there is a way to enable UFCS without such wrapper sorry my attention got stuck on the singleton. So my suggestion is rather to only enable the ufcs style. This highlights the fact that the class

Re: Singleton Object, calling member functions using UFCS (an "ugly?" example) ... better way?

2021-09-01 Thread user1234 via Digitalmars-d-learn
On Wednesday, 1 September 2021 at 16:02:47 UTC, james.p.leblanc wrote: Dear D-ers, For simple plotting using a gnuplot process, I have created a singleton object (a stripped down minimal working example is below.) [...] **However, those wrapper functions in the gnuplot_mod module looks a

Re: DMD compiler - warning of unused variables

2021-08-16 Thread user1234 via Digitalmars-d-learn
On Monday, 16 August 2021 at 14:14:27 UTC, DLearner wrote: Is there a compiler option that would warn that variable 'j' is defined but not used? Best regards No in DMD but you can use [D-Scanner](https://code.dlang.org/packages/dscanner) for that. The check works reasonably as long as

Re: Create alias of same name in inner scope, bug or feature?

2021-08-14 Thread user1234 via Digitalmars-d-learn
On Saturday, 14 August 2021 at 04:09:34 UTC, Tejas wrote: [...] Oh right, the ```.``` operator will reference variable in the _module_ scope, not just the _immediate outer scope_, you can use the module name to disambiguate as well. To extend Mike answer, the general rule is that if you can

Re: How to extend the string class to return this inside the square bracket?

2021-08-14 Thread user1234 via Digitalmars-d-learn
On Friday, 13 August 2021 at 23:33:05 UTC, Paul Backus wrote: On Friday, 13 August 2021 at 23:23:55 UTC, Marcone wrote: writeln("Hello World!"[x.indexOf("e")..x.indexOf("r")]); indexOf()is just a simple example, not the goal. I want handle literal inside [] like it bellow, but in literal:

Re: How to extend the string class to return this inside the square bracket?

2021-08-13 Thread user1234 via Digitalmars-d-learn
On Friday, 13 August 2021 at 21:05:22 UTC, Marcone wrote: How to extend the string class to return this inside the square bracket the same way opDollar $ returns the length of the string? Thank you. import std; void main(){ writeln("Hello World!"[0..this.indexOf("o")]); }

Re: Debugging linker errors

2021-08-08 Thread user1234 via Digitalmars-d-learn
On Sunday, 8 August 2021 at 11:58:42 UTC, Bogdan wrote: Hi, I tried to update my server from dmd v2.096.1 to v2.097 and I started getting this linker error: ``` Linking... /usr/bin/ld:

Re: Is returning void functions inside void functions a feature or an artifact?

2021-08-02 Thread user1234 via Digitalmars-d-learn
On Monday, 2 August 2021 at 14:31:45 UTC, Rekel wrote: I recently found one can return function calls to void functions, though I don't remember any documentation mentioning this even though it doesn't seem trivial. [...] If this is intended, where could I find this in the docs? I haven't

Re: Registering-unregistering threads

2021-08-02 Thread user1234 via Digitalmars-d-learn
On Friday, 30 July 2021 at 23:48:41 UTC, solidstate1991 wrote: I'm doing some audio-related work, and one thing I need is to unregister from (and maybe later temporarily re-register to) the GC, since it would cause some issues, GC + audio is only a problem if its pauses (e.g in the audio

Re: Why are class methods not allowed to call cons/destructors?

2021-07-31 Thread user1234 via Digitalmars-d-learn
On Saturday, 31 July 2021 at 13:12:21 UTC, Tejas wrote: ```d class A{ ~this(){} destructA(){ ~this() } } class B:A{ ~this(){} destructB(){ ~this(); ~super(); } } ``` This could allow ```@nogc``` crowd to run destructors without calling

Re: Why does Unconst exist?

2021-07-28 Thread user1234 via Digitalmars-d-learn
On Wednesday, 28 July 2021 at 05:38:44 UTC, Tejas wrote: When I initially saw it, I was hopeful that it would allow me to bypass some of the restrictions of ```const``` , but it literally just takes a type and strips the ```const``` from it, you can't pass a variable to it in order to get rid

Re: Destructors can't be @nogc?

2021-07-24 Thread user1234 via Digitalmars-d-learn
On Friday, 23 July 2021 at 20:24:02 UTC, Jim wrote: Hello, I've been playing with D and trying to understand how to work with @nogc. I must be doing something wrong, because even though I tagged the destructor for my class `@nogc`, I'm getting the following error: `.\min.d(27): Error:

Re: Destructors can't be @nogc?

2021-07-24 Thread user1234 via Digitalmars-d-learn
On Sunday, 25 July 2021 at 01:17:06 UTC, user1234 wrote: That bypasses the runtime mechanism for classes construction and destruction. But `new` and `destroy` must not be called anymore, you must get stick with your own system. and of course `cast(Object)` should be prohibited (maybe `opCast`

Re: Generate docs for generated code?

2021-07-23 Thread user1234 via Digitalmars-d-learn
On Friday, 23 July 2021 at 10:04:55 UTC, wjoe wrote: Is there a way for the compiler to consider doc comments in auto generated, mixed in code? E.g. ```D string fooImpl = q{ /// Bar does fancy things. const void bar() { /*do something fancy*/ } }; /// This is Foo struct Foo(A, B, C) {

Re: How to select the regex that matches the first token of a string?

2021-07-03 Thread user1234 via Digitalmars-d-learn
On Saturday, 3 July 2021 at 09:05:28 UTC, vnr wrote: Hello, I am trying to make a small generic lexer that bases its token analysis on regular expressions. The principle I have in mind is to define a token type table with its corresponding regular expression, here is the code I currently

Re: Presentation on D in Insurance Data Science Conference

2021-06-26 Thread user1234 via Digitalmars-d-announce
On Wednesday, 23 June 2021 at 17:26:04 UTC, data pulverizer wrote: Hi Guys, I recently gave a presentation (7 minutes since the conference became very popular) introducing the D programming language to the insurance industry:

Re: (Oh My) Gentool 0.3.0 released

2021-05-05 Thread user1234 via Digitalmars-d-announce
On Wednesday, 5 May 2021 at 11:51:27 UTC, evilrat wrote: On Wednesday, 5 May 2021 at 10:35:23 UTC, Dominikus Dittes Scherkl wrote: On Wednesday, 5 May 2021 at 10:01:13 UTC, user1234 wrote: ... To answer both: clang has lots of templates, sometimes not so trivial ones, its code base filled

Re: (Oh My) Gentool 0.3.0 released

2021-05-05 Thread user1234 via Digitalmars-d-announce
On Wednesday, 5 May 2021 at 06:50:29 UTC, evilrat wrote: (Oh My) Gentool - Yet another C/C++ binding generator. It is a tool to convert C/C++ code to D usable form. It takes JSON config, basically all C++ compiler flags and switches, and outputs extern(C++) declarations, (hopefully) in usable

Re: dlang vs crystal-language

2021-05-03 Thread user1234 via Digitalmars-d-learn
On Saturday, 1 May 2021 at 13:04:15 UTC, sighoya wrote: On Wednesday, 28 April 2021 at 22:41:03 UTC, Alain De Vos wrote: What are the strengths and weaknesses comparing the two languages ? I can name a strength of dlang is the working binding to tk and gtk. Just to say, Crystal is a neat

Re: Since dmd 2.096.0: import `x.t` is used as a type

2021-04-30 Thread user1234 via Digitalmars-d-learn
On Friday, 30 April 2021 at 17:58:43 UTC, kdevel wrote: dmd since 2.096.0 with ``t.d`` ```t.d module t; class t { } ``` and ``x.d`` ```x.d module x; import t; void main () { t x = new t; } ``` reports $ dmd -i x.d x.d(6): Error: import `x.t` is used as a type x.d(6): Error:

Re: Deriving a D-class from a CPP-class

2021-04-29 Thread user1234 via Digitalmars-d-learn
On Thursday, 29 April 2021 at 06:38:53 UTC, evilrat wrote: On Wednesday, 28 April 2021 at 19:46:00 UTC, Alain De Vos wrote: It is rather clear what I want to achieve but virtual functions give me headache because dlang does not now the word virtual. It's virtual by default. The opposite is

Re: Static array initialisation

2021-04-01 Thread user1234 via Digitalmars-d-learn
On Thursday, 1 April 2021 at 09:30:28 UTC, DLearner wrote: On Wednesday, 31 March 2021 at 23:21:59 UTC, russhy wrote: On Wednesday, 31 March 2021 at 17:54:38 UTC, DLearner wrote: [...] Can you show the print function? Maybe the problem lies there? Using rdmd, I believe the code below

Re: rdmd and D equivalent for PYTHONPATH?

2021-03-17 Thread user1234 via Digitalmars-d-learn
On Wednesday, 17 March 2021 at 07:13:31 UTC, Chris Piker wrote: On Wednesday, 17 March 2021 at 06:07:01 UTC, user1234 wrote: [...] Very handy example. Unfortunately it means that paths are embedded in scripts, which is usually a bad idea. [...] You can use a local registry too. That

Re: rdmd and D equivalent for PYTHONPATH?

2021-03-17 Thread user1234 via Digitalmars-d-learn
On Wednesday, 17 March 2021 at 04:34:07 UTC, Chris Piker wrote: On Wednesday, 17 March 2021 at 03:43:22 UTC, Chris Piker wrote: Note: I'm aware of dub. This isn't a question about dub. I'm making scripts for local use, not redistributable binaries, so I would like to "install" mir-algorithm

Re: D's Continous Changing

2021-03-04 Thread user1234 via Digitalmars-d-learn
On Thursday, 4 March 2021 at 09:21:12 UTC, Siemargl wrote: On Thursday, 4 March 2021 at 06:43:57 UTC, user1234 wrote: otherwise another solution is to check every two monthes the sanity of your projects. E.g a montly cronjob on a CI service and that uses latest DMD Docker image. If it fails

Re: D's Continous Changing

2021-03-03 Thread user1234 via Digitalmars-d-learn
On Thursday, 4 March 2021 at 05:44:53 UTC, harakim wrote: For the record, I was able to resolve all of my issues in about 7 hours. That included upgrading from DerelictSDL to bindbc and converting to use dub instead of make. I hope my above post does not lead people to believe that I don't

Re: DUB is not working correctly

2021-02-25 Thread user1234 via Digitalmars-d-learn
On Thursday, 25 February 2021 at 17:34:29 UTC, Maxim wrote: In my opinion, that happens because of DUB can't accept my changes to the file. But how to make the manager admit it? I apologize to everyone who understood me wrong. If you use an ide to edit the DUB receipt maybe it's possible

Re: Ugly c++ syntax

2021-02-06 Thread user1234 via Digitalmars-d-learn
On Friday, 5 February 2021 at 21:10:21 UTC, Rumbu wrote: Can some C++ guru translate in D the template below? I gave up after reading a lot, but I didn't manage to understand the meaning "&& ..." template static uint8_t composite_index_size(Tables const&... tables) { return

Re: How to debug D on Linux

2021-01-13 Thread user1234 via Digitalmars-d-learn
On Wednesday, 13 January 2021 at 13:47:55 UTC, Roguish wrote: On Wednesday, 13 January 2021 at 13:30:48 UTC, Roguish wrote: Anything else I need to know when debugging on Linux, without an IDE? One specific question I have is: what's the difference between -g and -debug and -d-debug? Also,

Re: Request assistance initializing struct instance at global scope

2020-12-06 Thread user1234 via Digitalmars-d-learn
On Monday, 7 December 2020 at 05:28:41 UTC, user1234 wrote: On Monday, 7 December 2020 at 04:13:16 UTC, Andrew Edwards wrote: Given: === extern(C): char*[] hldr; enum I = (1<<0); struct S { char* ft; char** fm; int f; } void main(){} === How do I initialize an

Re: Request assistance initializing struct instance at global scope

2020-12-06 Thread user1234 via Digitalmars-d-learn
On Monday, 7 December 2020 at 04:13:16 UTC, Andrew Edwards wrote: Given: === extern(C): char*[] hldr; enum I = (1<<0); struct S { char* ft; char** fm; int f; } void main(){} === How do I initialize an instance of S at global scope? You cant. At the global scope the

Re: What compiler flags can be passed to a Dlang compiler

2020-12-06 Thread user1234 via Digitalmars-d-debugger
On Sunday, 6 December 2020 at 11:48:34 UTC, tejas89 wrote: What compiler flags can be passed to a Dlang compiler? Definition of compiler flag being something like say “—wall” or “—werror” for example. I’m not sure what is available for the language since I’m new to it and hope to learn D as

Re: ParameterIdentifierTuple returns empty strings

2020-12-02 Thread user1234 via Digitalmars-d-learn
On Wednesday, 2 December 2020 at 11:46:26 UTC, Andre Pany wrote: Hi, I need to retrieve the parameter identifier but only empty strings are returned: tuple("", "") ``` d alias fpt = extern(C) nothrow void function(int a, int b); void main() { import std.traits :

Re: New vs length on dymamic array

2020-11-09 Thread user1234 via Digitalmars-d-learn
On Monday, 9 November 2020 at 08:06:54 UTC, Andrey wrote: Hello, Are here any differences in creation of dynamic array with known size? auto array = new wchar[](111); and wchar[] array; array.length = 111; It's the same. If the two are valid then you are in a function. So it's an

Re: Question about: ("1.1").to!int;

2020-10-23 Thread user1234 via Digitalmars-d-learn
On Friday, 23 October 2020 at 13:57:41 UTC, Joseph Rushton Wakeling wrote: On Wednesday, 21 October 2020 at 22:50:27 UTC, matheus wrote: Since (1.1).to!int = 1, shouldn't the string value ("1.1").to!int at least try to convert to float/double and then to int? The thing is, that's a great way

Re: Renaming Flag!"" in API

2020-10-12 Thread user1234 via Digitalmars-d-learn
On Monday, 12 October 2020 at 10:24:44 UTC, FreeSlave wrote: Let's say I use Flag type named 'myflagname' in API like this: import std.typecons; void func(Flag!"myflagname" flag) { //... } void main() { func(Yes.myflagname); } Later I realize that 'myflagname' is a bad name and I want to

Re: Release D 2.094.0

2020-10-11 Thread user1234 via Digitalmars-d-announce
On Sunday, 11 October 2020 at 15:52:19 UTC, Anonymouse wrote: On Saturday, 26 September 2020 at 21:45:09 UTC, Martin Nowak Binaries took a while to hit Arch repositories, but now they did and I'm immediately pleasantly surprised. 2.093.1: $ time dub build -c dev Performing "debug" build

Re: Trying to create a trivial 64 bit D Lang DLL on a Windows 10 machine and cant get past linking.

2020-10-01 Thread user1234 via Digitalmars-d-learn
On Wednesday, 30 September 2020 at 11:45:53 UTC, Ferhat Kurtulmuş wrote: On Tuesday, 29 September 2020 at 21:22:21 UTC, WhatMeWorry wrote: module user; export { int myAddSeven(int a, int b); } [...] it is better to use this template https://github.com/dlang/dmd/tree/master/samples/mydll

Re: Release D 2.094.0

2020-10-01 Thread user1234 via Digitalmars-d-announce
On Thursday, 1 October 2020 at 07:02:12 UTC, Imperatorn wrote: On Sunday, 27 September 2020 at 19:20:34 UTC, Daniel N wrote: On Saturday, 26 September 2020 at 22:12:17 UTC, Imperatorn wrote: On Saturday, 26 September 2020 at 21:45:09 UTC, Martin Nowak wrote: Glad to announce D 2.094.0, ♥ to

Re: Unable to open filename passed as command line argument

2020-09-03 Thread user1234 via Digitalmars-d-learn
On Thursday, 3 September 2020 at 10:47:04 UTC, Curious wrote: Given the following: =a== void main(string[] args) { FILE* fp = fopen(args[1].ptr, "r"); if (!fp) throw new Exception("fopen"); } =b== void main(string[] args) { FILE* fp = fopen(args[1].dup.ptr, "r");

D mentionned in the ARTIBA webzine for an article on Silq

2020-09-01 Thread user1234 via Digitalmars-d-announce
«Trivia: - Silq is written in the D programming language. - To install Silq via vscode, see: https://silq.ethz.ch/install. - A timeline of major developments in quantum computing: »

Re: Tuple poilerplate code

2020-08-31 Thread user1234 via Digitalmars-d-learn
On Tuesday, 1 September 2020 at 02:08:54 UTC, JG wrote: Is there anyway to remove the boilerplate code of dealing with tuples: I find myself having to write things like this fairly often auto someRandomName = f(...); //where f returns a tuple with two parts auto firstPart =

Re: Article: The surprising thing you can do in the D programming language

2020-08-20 Thread user1234 via Digitalmars-d-announce
On Thursday, 20 August 2020 at 10:12:22 UTC, aberba wrote: Wrote something on OpenSource.com https://opensource.com/article/20/8/nesting-d I'm not sure. A few notes on nesting. 1. context pointer can prevent inlining. you can nest static funcs, but then what is the point 2. bad complexity.

Re: Since DMD 2.089.0 and later, compiled .exe showing SFX zip and opening with winRar when use resource.

2020-08-18 Thread user1234 via Digitalmars-d-learn
On Tuesday, 18 August 2020 at 19:01:17 UTC, Marcone wrote: When I compile the source .d code to .exe adding an icon using resource .res file in dmd 2.089.0 and later, the .exe file show SFX zip in it is properties and open with winRar. This ir normal or is a Bug? See images below. Se image

Re: __vector(ubyte[32]) misalignment

2020-08-08 Thread user1234 via Digitalmars-d-learn
On Sunday, 9 August 2020 at 01:56:54 UTC, Bruce Carneal wrote: On Sunday, 9 August 2020 at 01:03:51 UTC, Bruce Carneal wrote: The .alignof attribute of __vector(ubyte[32]) is 32 but initializing an array of such vectors via an assignment to .length has given me 16 byte alignment (and

Re: Picking function templates with __traits(getOverloads, ..., true)

2020-07-29 Thread user1234 via Digitalmars-d-learn
On Wednesday, 29 July 2020 at 23:57:21 UTC, Jean-Louis Leroy wrote: This works: [...] I may be missing the obvious...or it's a compiler bug??? Yes and it's just been fixed, see https://github.com/dlang/dmd/pull/11431. So uncommenting the second times works on ~master.

Re: Uploading coverage to Codecov doesn't work

2020-07-08 Thread user1234 via Digitalmars-d-learn
On Wednesday, 8 July 2020 at 15:55:58 UTC, Mitacha wrote: Hello there, I've been trying to setup bitbucket pipelines to submit coverage to codecov, but with no luck. I use `dub run -b unittest-cov` and it generates .lst files correctly, then `bash <(curl -s https://codecov.io/bash) -t

Re: Construct an used-defined hash table container type from an AA-literal expression

2020-07-05 Thread user1234 via Digitalmars-d-learn
On Sunday, 5 July 2020 at 21:38:12 UTC, Per Nordlöw wrote: On Sunday, 5 July 2020 at 21:22:13 UTC, ikod wrote: struct AA(K,V) { void opAssign(V[K] aa) { } } void main() { AA!(string, int) custom_aa; custom_aa = ["one":1, "two":2]; } Forget to mention that I want the

Re: Construct an used-defined hash table container type from an AA-literal expression

2020-07-05 Thread user1234 via Digitalmars-d-learn
On Sunday, 5 July 2020 at 21:06:32 UTC, Per Nordlöw wrote: Is there a way to construct a custom written hash-table container (struct) from an AA-literal expression? How about iterating the literal, e.g --- foreach (k,v; ["one":1, "two":2]) { myCustomAA[k] = v; } ---

Re: Visual D 1.0.0 released

2020-07-04 Thread user1234 via Digitalmars-d-announce
On Saturday, 4 July 2020 at 13:00:16 UTC, Rainer Schuetze wrote: Hello, after having passed the 10 year anniversary of public availability recently, it is finally time to release version 1.0 of Visual D, the Visual Studio extension that adds D language support to VS 2008-2019. You can find

Re: Visual D 1.0.0 released

2020-07-04 Thread user1234 via Digitalmars-d-announce
On Saturday, 4 July 2020 at 22:25:06 UTC, user1234 wrote: On Saturday, 4 July 2020 at 13:00:16 UTC, Rainer Schuetze wrote: This would have been worth a post in D.announce but D.learn is nice too I suppose ;) The post appears in the two sections for some reason so there's no problem actually.

Re: dmd release schedule?

2020-07-04 Thread user1234 via Digitalmars-d-learn
On Saturday, 4 July 2020 at 20:48:02 UTC, drathier wrote: On Sunday, 28 June 2020 at 10:44:26 UTC, drathier wrote: Is there a release schedule anywhere for DMD? Any list of tasks to be the next release? I'm only finding 5+ year old things when searching. Yes:

Re: Release Candidate [was: Re: Beta 2.093.0]

2020-07-03 Thread user1234 via Digitalmars-d-announce
On Friday, 3 July 2020 at 19:50:51 UTC, aberba wrote: On Friday, 3 July 2020 at 15:27:54 UTC, user1234 wrote: On Friday, 3 July 2020 at 11:10:25 UTC, Martin Nowak wrote: On Wednesday, 24 June 2020 at 21:01:05 UTC, Martin Nowak wrote: Glad to announce the first beta for the 2.093.0 release, ♥

Re: Release Candidate [was: Re: Beta 2.093.0]

2020-07-03 Thread user1234 via Digitalmars-d-announce
On Friday, 3 July 2020 at 11:10:25 UTC, Martin Nowak wrote: On Wednesday, 24 June 2020 at 21:01:05 UTC, Martin Nowak wrote: Glad to announce the first beta for the 2.093.0 release, ♥ to the 53 contributors. Release Candidate is live now. thanks but Have you see that full changelog is still

Re: News on the D Blog: SAOC 2020 and More

2020-06-23 Thread user1234 via Digitalmars-d-announce
On Tuesday, 23 June 2020 at 12:00:30 UTC, Mike Parker wrote: On Tuesday, 23 June 2020 at 12:00:06 UTC, Mike Parker wrote: Symmetry Autumn of Code 2020 is on! My latest news post on the D Blog talks about that, some D Language Foundation finance updates, and whispers on the wind. And you can

Re: Rules for Symbol Name Lookup seem contradictory

2020-06-21 Thread user1234 via Digitalmars-d-learn
On Monday, 22 June 2020 at 01:38:41 UTC, Manfred Nowak wrote: https://dlang.org/spec/module.html#name_lookup contains under 4.3.4 only two sentences. While the first sentence explains, that the search ends "as soon as a matching symbol is found", the second sentence implies that the search

Re: Passing a variable number of slices into a function

2020-06-21 Thread user1234 via Digitalmars-d-learn
On Monday, 22 June 2020 at 01:47:49 UTC, repr-man wrote: Is there any way to pass an unknown number of slices into a function? I'm trying to do something along the lines of: void func(T)(T[] args...) { //... } That wasn't working, [...] Thanks for the help! Can you provide more

Re: Should a parser type be a struct or class?

2020-06-17 Thread user1234 via Digitalmars-d-learn
On Wednesday, 17 June 2020 at 11:50:27 UTC, Per Nordlöw wrote: Should a range-compliant aggregate type realizing a parser be encoded as a struct or class? In dmd `Lexer` and `Parser` are both classes. In general how should I reason about whether an aggregate type should be encoded as a

Re: Interesting work on packing tuple layout

2020-06-13 Thread user1234 via Digitalmars-d-announce
On Saturday, 13 June 2020 at 19:11:33 UTC, Andrei Alexandrescu wrote: https://github.com/ZigaSajovic/optimizing-the-memory-layout-of-std-tuple Would be interesting to adapt it for std.tuple. Look possible. At first glance, staticSort on the template variadic argument based on a predicate

Re: Beta 2.092.1

2020-06-13 Thread user1234 via Digitalmars-d-announce
On Thursday, 4 June 2020 at 18:01:55 UTC, Martin Nowak wrote: Glad to announce the first beta for the 2.092.1 point release, ♥ to the 8 contributors. http://dlang.org/download.html#dmd_beta http://dlang.org/changelog/2.092.1.html As usual please report any bugs at https://issues.dlang.org

Re: Alias function declaration.

2020-05-19 Thread user1234 via Digitalmars-d-learn
On Tuesday, 19 May 2020 at 22:04:49 UTC, MaoKo wrote: Hello. I just want to find what is exactly the difference between: alias _ = void function(int); alias void _(int); Because it's seem that the latter can't be used in the declaration of an array (eg: _[] ...). I think the first is a pointer

Re: final struct ?

2020-05-19 Thread user1234 via Digitalmars-d-learn
On Tuesday, 19 May 2020 at 10:29:51 UTC, wjoe wrote: On Tuesday, 19 May 2020 at 10:08:37 UTC, user1234 wrote: On Tuesday, 19 May 2020 at 10:01:34 UTC, wjoe wrote: [...] It has no purpose. In D many attributes are allowed even if they have no meaning. D-Scanner checks this kind of stuff, to

Re: final struct ?

2020-05-19 Thread user1234 via Digitalmars-d-learn
On Tuesday, 19 May 2020 at 10:01:34 UTC, wjoe wrote: As I was reading a few source files of a library I found dozens of final struct declarations like this: final struct Foo { const pure final nothrow bar() { ... } } What's this supposed to express ? A final class is a class that can't

Re: [OT] What do you guys think of dark comedy channel on IT sh.. stuff?

2020-05-13 Thread user1234 via Digitalmars-d-announce
On Tuesday, 12 May 2020 at 07:52:29 UTC, Dmitry Olshansky wrote: I find that I can vaguely amusing 100% of the day and I love standup comedy... "standup" lol. That reminds mesomeone who likes this genre too but he's not here anymore... you see just in case of...

Re: [OT] What do you guys think of dark comedy channel on IT sh.. stuff?

2020-05-13 Thread user1234 via Digitalmars-d-announce
On Wednesday, 13 May 2020 at 07:29:54 UTC, Dmitry Olshansky wrote: On Wednesday, 13 May 2020 at 07:02:20 UTC, Dmitry Olshansky wrote: On Tuesday, 12 May 2020 at 07:52:29 UTC, Dmitry Olshansky wrote: I find that I can vaguely amusing 100% of the day and I love standup comedy... And I’m too

Re: Can’t use UFCS to create InputRange?

2020-04-29 Thread user1234 via Digitalmars-d-learn
On Wednesday, 29 April 2020 at 08:34:53 UTC, Ogi wrote: struct R {} int front(R r) { return 42; } void popFront(R r) {} bool empty(R r) { return false; } void main() { import std.range.primitives : isInputRange; static assert(isInputRange!R); } Error: static assert:

Re: Working with cmd

2020-04-18 Thread user1234 via Digitalmars-d-learn
On Friday, 17 April 2020 at 21:38:23 UTC, Quantium wrote: Are there any libs which can be used to access cmd commands? You can pipe cmd.exe: --- import std.process : pipeProcess, ProcessPipes; ProcessPipes pp = pipeProcess(["cmd.exe"]); pp.stdin.writeln("echo foobar"); pp.stdin.close;

Re: [dmd] Types and ScopeDsymbol

2020-04-02 Thread user1234 via Digitalmars-d-learn
On Wednesday, 1 April 2020 at 18:47:38 UTC, drug wrote: Is it true that user defined types are resolved to ScopeDsymbol and basic types aren't? a basic type does not need to introduce a scope since it has no members. All operators on them are supported natively and are no modifiable, so yes

Re: Type sequence concatenation / associative array implementation

2020-02-12 Thread user1234 via Digitalmars-d-learn
On Wednesday, 12 February 2020 at 20:58:49 UTC, Marcel wrote: Hello! I have two questions: 1- How can I concatenate two type sequences? alias Concatenated = AliasSeq!(TList1, TList2); or maybe alias Concatenated = AliasSeq!(TList1[0..$], TList2[0..$]); since I don't remember if they nest

Re: Some impressions/notes from a new D programmer

2020-02-12 Thread user1234 via Digitalmars-d-learn
On Wednesday, 12 February 2020 at 15:28:57 UTC, Anonymouse wrote: Maybe there are some hard design decisions again $HOME/.dub/bin, unsure. It might be difficult to globally pull off if programs expect the binary to be placed in the source tree (for resources). [1]:

Re: Type Inference and Try Blocks

2020-01-20 Thread user1234 via Digitalmars-d-learn
On Monday, 20 January 2020 at 23:16:07 UTC, Henry Claesson wrote: This isn't a D-specific "problem", but there may be D-specific solutions. I have a function `doSomething()` that returns a Voldemort type, and this same function also throws. So, there's this: try { auto foo =

Re: CTFE and assoc array

2020-01-19 Thread user1234 via Digitalmars-d-learn
On Sunday, 19 January 2020 at 13:02:18 UTC, Andrey wrote: On Saturday, 18 January 2020 at 21:44:35 UTC, Boris Carvajal wrote: I read that thread. But: Deprecation: initialization of immutable variable from static this is deprecated. Use shared static this instead. And we get? No CTFE with

Re: Practical parallelization of D compilation

2020-01-08 Thread user1234 via Digitalmars-d-learn
On Wednesday, 8 January 2020 at 04:40:02 UTC, Guillaume Lathoud wrote: Hello, One of my D applications grew from a simple main and a few source files to more than 200 files. Although I minimized usage of templating and CTFE, the compiling time is now about a minute. I did not find any

Re: @disable("reason")

2020-01-08 Thread user1234 via Digitalmars-d-learn
On Wednesday, 8 January 2020 at 00:23:48 UTC, Marcel wrote: Hello! I'm writing a library where under certain conditions i need all the default constructors to be disabled. I would like to tell the user why they can't instantiate the struct. Is there a way to do that? class Example {

Re: ssll - simple shared library loader

2020-01-06 Thread user1234 via Digitalmars-d-announce
On Sunday, 5 January 2020 at 23:23:48 UTC, Oleg B wrote: It's analog of bindbc, but without need write boilerplate code. May be bindbc is designed for another cases, but I don't understand need writing triple definition for one function (pointer, loading, wrap-function). ssll betterC

Re: Why same pointer type for GC and manual memory?

2019-11-15 Thread user1234 via Digitalmars-d-learn
On Wednesday, 13 November 2019 at 11:07:12 UTC, IGotD- wrote: I'm trying to find the rationale why GC pointers (should be names managed pointers) are using the exact same type as any other pointer. Doesn't this limit the ability to change the default GC type? Doesn't this confusion make GC

Re: std.container.array: Error: unable to determine fields of Test because of forward references

2019-10-31 Thread user1234 via Digitalmars-d-learn
On Thursday, 31 October 2019 at 12:37:55 UTC, user1234 wrote: On Thursday, 31 October 2019 at 12:29:28 UTC, Tobias Pankrath wrote: [...] Try struct S { S*[] children; } because otherwise when you declare the array the compiler has not finished the semantic ana of S. so S size is not

<    1   2   3   4   >