Re: openssl 1.1 vs. 3.0 for vibe.d:tls on Ubuntu 22.04

2023-08-01 Thread Mathias LANG via Digitalmars-d-learn
On Friday, 28 July 2023 at 08:56:17 UTC, Guillaume Lathoud wrote: Hello, some context first: I recently updated a server to Ubuntu 22.04 which appears to have only openssl 3.0.2 installed. Dub could compile my project, but could not link it anymore, as the D code seemed to be expecting openss

Re: Warning The package will no longer be detected starting from v1.42.0

2023-06-25 Thread Mathias LANG via Digitalmars-d-learn
On Sunday, 25 June 2023 at 04:50:42 UTC, Soulsbane wrote: I'm guessing it's caused by this https://github.com/dlang/dub/pull/2610. What's the fix for this exactly? Thanks! A fix would be to do the following: ``` for package in $($HOME/Projects/D/libs/*); do mv -v $package $package/master/

Re: constant pointer failing to compile

2023-04-05 Thread Mathias LANG via Digitalmars-d-learn
immutable ubyte[4] data = [1, 2, 3, 4]; Using a static array instead of a slice will do the trick. You can leave the `__gshared` if you want, but it is redundant on a global, initialized `immutable` variable.

Re: Which TOML package, or SDLang?

2023-01-30 Thread Mathias LANG via Digitalmars-d-learn
On Monday, 30 January 2023 at 06:38:46 UTC, Daren Scot Wilson wrote: So, which package do I use for TOML? I find these three: * toml-foolery (Andrej Petrović) * toml-d, or toml.d (oglu on github) at ver 0.3.0 * toml, (dlang community on github) at ver 2.0.1 I'm guessing from version numbers t

Re: forgetting -betterC means no runtime bounds checking?

2023-01-05 Thread Mathias LANG via Digitalmars-d-learn
On Thursday, 5 January 2023 at 09:17:28 UTC, areYouSureAboutThat wrote: core.exception.ArrayIndexError@test.d(25): index [5] exceeds array of length 5 Aborted (core dumped) This is bounds checking happening.

Re: Makefiles and dub

2022-11-08 Thread Mathias LANG via Digitalmars-d-learn
On Friday, 4 November 2022 at 23:19:17 UTC, Anonymouse wrote: [#20699](https://issues.dlang.org/show_bug.cgi?id=20699) must be non-trivial to fix, so I'm exploring makefiles. If possible I'd like to keep dub for dependency management though, just not for actual compilation. That bug is fixed

Re: Best practice for dub registry package and module names

2022-09-03 Thread Mathias LANG via Digitalmars-d-learn
On Sunday, 4 September 2022 at 01:52:11 UTC, Ali Çehreli wrote: Should the package be the author's name: acehreli.a, acehreli.b, and acehreli.c? I use this approach: https://forum.dlang.org/thread/jdkmtgftmwtwaxxqh...@forum.dlang.org

Re: Constructors not working

2022-09-03 Thread Mathias LANG via Digitalmars-d-learn
On Friday, 2 September 2022 at 18:35:22 UTC, Svyat wrote: I write this code in one directory: ``` module time; struct Time { public int hours, minutes, seconds; this(int h, int m, int s) { hours = h; minutes = m; seconds = s; }

Re: Comping a Musl-linked druntime & phobos?

2022-08-24 Thread Mathias LANG via Digitalmars-d-learn
On Thursday, 25 August 2022 at 01:45:50 UTC, TheGag96 wrote: Hi, all. Has anyone had any success compiling a Musl-linked druntime and phobos? I haven't had any luck so far. I'm running Linux Mint x64. Somewhat related - using `-target=x86_64-linux-musl` with dmd master doesn't even set the ve

Re: Approach to Integration Testing in D

2022-02-04 Thread Mathias LANG via Digitalmars-d-learn
On Friday, 4 February 2022 at 12:38:08 UTC, Vijay Nayar wrote: Greetings everyone, ## Question What is your approach to integration testing in D? Do you use `unittest` blocks? Do you write stand-alone programs that interact with a running version of your program? Is there a library that make

Re: "need `this` for `s` of type `char*`" error message

2021-11-10 Thread Mathias LANG via Digitalmars-d-learn
On Thursday, 11 November 2021 at 07:10:39 UTC, Mathias LANG wrote: [...] Your type definition is wrong: ```D struct toml_datum_t { int ok; union u { toml_timestamp_t* ts; /* ts must be freed after use */ char* s; /* string value. s must be freed after use */ int b; /* bool

Re: "need `this` for `s` of type `char*`" error message

2021-11-10 Thread Mathias LANG via Digitalmars-d-learn
On Thursday, 11 November 2021 at 07:04:57 UTC, rempas wrote: After not being able to use ImportC to automatically compile a C library, now I'm trying to do it myself. The library I want to use is [tomlc99](https://github.com/cktan/tomlc99) which is a small C library to parse toml files. Now I c

Re: A way to mixin during runtime?

2021-08-27 Thread Mathias LANG via Digitalmars-d-learn
On Friday, 27 August 2021 at 06:52:10 UTC, Kirill wrote: Is there a way to do mixin or similar during runtime? I'm trying to read a csv file and extract data types. Any ideas on how this should be approached in D are greatly appreciated. You cannot mixin at runtime. However, it is fairly easy

Re: Potential strategy for avoiding problems with copy of a struct (maybe??)

2021-08-22 Thread Mathias LANG via Digitalmars-d-learn
On Sunday, 22 August 2021 at 07:58:12 UTC, james.p.leblanc wrote: Is there a better way? Best Regards, James ``` public mixin template NonMovableOrCopyable () { @disable this (); @disable this (this); @disable ref typeof (this) opAssign () (auto ref typeof(this) rhs); } ``` Thi

Re: modules and mains

2021-08-22 Thread Mathias LANG via Digitalmars-d-learn
On Sunday, 22 August 2021 at 03:22:02 UTC, Brian Tiffin wrote: Is this wrong thinking? I'm ~~working on~~ playing with a first project. Meant to be a suite of tools, each usable from the command line, i.e. with a `main`. Then a manager program that accepts subcommands for dispatch *and othe

Re: Drawbacks of exceptions being globally allocated

2021-08-15 Thread Mathias LANG via Digitalmars-d-learn
On Monday, 16 August 2021 at 05:36:07 UTC, Tejas wrote: That is why I was using heapAllocate, because using `new` on scope allocates exception on stack, and if you exit, then the exception is basically freed before it even gets caught. It fails even when you catch within the same function.

Re: Drawbacks of exceptions being globally allocated

2021-08-14 Thread Mathias LANG via Digitalmars-d-learn
On Sunday, 15 August 2021 at 02:09:08 UTC, Tejas wrote: On Sunday, 15 August 2021 at 00:15:32 UTC, Ali Çehreli wrote: On 8/14/21 4:41 AM, Tejas wrote: > [...] exception > [...] So, there would be many exception objects one for each place that an exception can be thrown. Functions like enforce

Re: input range with non copyable element

2021-08-08 Thread Mathias LANG via Digitalmars-d-learn
On Sunday, 8 August 2021 at 18:36:02 UTC, vit wrote: Hello, is there reason why elements of input range must be copyable? By design, not that I can think of. But it is assumed all over the place, unfortunately. You can make your `front` method return by `ref`, but you're still going to get bi

Re: __FILE__

2021-08-04 Thread Mathias LANG via Digitalmars-d-learn
On Monday, 26 July 2021 at 11:43:56 UTC, workman wrote: file test.d: - module test; import abc; void doTest(){ log!"test"(); } --- file abc.d: - module abc; import test; void log(string fmt, int line = __LINE__,

Re: module search paths

2021-08-04 Thread Mathias LANG via Digitalmars-d-learn
On Wednesday, 4 August 2021 at 04:51:48 UTC, Brian Tiffin wrote: With `import std.json` working for the other symbols like parseJSON? `gdc-11 (Ubuntu 11.1.0-1ubuntu1~18.04.1) 11.1.0` Have good. You are using GDC 11, which has an older version of the frontend. GDC is pretty great for targetin

Re: Name Mangling & its representation of D types

2021-08-03 Thread Mathias LANG via Digitalmars-d-learn
On Tuesday, 3 August 2021 at 20:29:10 UTC, NonNull wrote: On Tuesday, 3 August 2021 at 17:01:38 UTC, Mike Parker wrote: On Tuesday, 3 August 2021 at 16:43:52 UTC, NonNull wrote: how does it work for recursive types like a struct containing a pointer to a struct of the same type A struct `S` w

Re: Exit before second main with -funittest

2021-07-29 Thread Mathias LANG via Digitalmars-d-learn
On Friday, 30 July 2021 at 03:45:21 UTC, Ali Çehreli wrote: Almost all of my programs are in the following pattern: ```D import std.stdio; void main(string[] args) { version (unittest) { // Don't execute the main program when unit testing return; } } ``` Are you aware that this is

Re: Performance issue with fiber

2021-07-28 Thread Mathias LANG via Digitalmars-d-learn
On Wednesday, 21 July 2021 at 22:51:38 UTC, hanabi1224 wrote: Hi, I'm new to D lang and encounter some performance issues with fiber, not sure if there's something obviously wrong with my code. I took a quick look, and the first problem I saw was that you were using `spawnLinked` but not repl

Re: enum true, or 1

2021-07-21 Thread Mathias LANG via Digitalmars-d-learn
On Thursday, 22 July 2021 at 03:44:13 UTC, Brian Tiffin wrote: What is the preferred syntax for simple on/off states? Did I read that D was moving to strictly 1 and 0 literals instead of true/false on/off yes/no? If so, is there an idiom for yes/no/maybe -1,0,1 less/equal/greater? Excuse

Re: How to Fix Weird Build Failure with "-release" but OK with "-debug"?

2021-07-20 Thread Mathias LANG via Digitalmars-d-learn
On Wednesday, 21 July 2021 at 03:25:03 UTC, apz28 wrote: with below error message: ..\..\pham\db\db_skdatabase.d(140): Error: null dereference in function _D4pham2db10fbdatabase7FbArray__T13readArrayImplTbZQsMFNfCQCeQCc8database12DbNameColumnZAb ..\..\pham\db\db_skdatabase.d(139): Error: null d

Re: How to parse a json node that contains children of different types?

2021-07-20 Thread Mathias LANG via Digitalmars-d-learn
On Tuesday, 20 July 2021 at 21:18:12 UTC, Bagomot wrote: But there is a problem with different types. I understand that Object[] is not suitable here, but I don’t know how to do it. I ask you to help me with this. IIUC, the `arguments` are command line arguments passed to a Java program, a

Re: Including a file

2021-07-18 Thread Mathias LANG via Digitalmars-d-learn
On Sunday, 18 July 2021 at 17:48:53 UTC, Vindex wrote: On Sunday, 18 July 2021 at 17:31:24 UTC, Adam D Ruppe wrote: On Sunday, 18 July 2021 at 17:28:07 UTC, Vindex wrote: Error: file "thing.json" cannot be found or not in a path specified with -J You need to specify the path where it is found

Re: assert(false) and GC

2021-07-10 Thread Mathias LANG via Digitalmars-d-learn
On Saturday, 10 July 2021 at 01:38:06 UTC, russhy wrote: On Saturday, 10 July 2021 at 01:23:26 UTC, Steven Schveighoffer wrote: I think it's the throwing/catching of the `Throwable` that is allocating. But I don't know from where the allocation happens. -Steve i think you are right Try t

Re: vibe.d compilation error

2021-07-04 Thread Mathias LANG via Digitalmars-d-learn
On Sunday, 4 July 2021 at 12:36:24 UTC, seany wrote: Is there any way, I can avoid this error? You are using an old version of Vibe.d, change your dependency to "~>0.9.0".

Re: float price; if (price == float.nan) { // initialized } else { // uninitialized } ... valid ?

2021-06-29 Thread Mathias LANG via Digitalmars-d-learn
On Wednesday, 30 June 2021 at 04:03:24 UTC, someone wrote: On Wednesday, 30 June 2021 at 03:51:47 UTC, Mathias LANG wrote: ... is far from pretty but it works as expected, thanks for your tip ! Can be made a bit prettier with UFCS: ```d import std.math : isNaN; float lnumStockPricePrecedin

Re: float price; if (price == float.nan) { // initialized } else { // uninitialized } ... valid ?

2021-06-29 Thread Mathias LANG via Digitalmars-d-learn
On Wednesday, 30 June 2021 at 03:32:27 UTC, Vladimir Panteleev wrote: On Wednesday, 30 June 2021 at 03:15:46 UTC, someone wrote: Is the following code block valid ? Comparison with `nan` always results in `false`: See section 10.11.5: https://dlang.org/spec/expression.html#equality_expressio

Re: Are D classes proper reference types?

2021-06-28 Thread Mathias LANG via Digitalmars-d-learn
On Monday, 28 June 2021 at 06:13:06 UTC, Ola Fosheim Grøstad wrote: On Sunday, 27 June 2021 at 23:20:38 UTC, Mathias LANG wrote: - It locks us in a position where we depend on an external committee / implementation to define our ABI. Well, that could be an issue, but it is not likely to change

Re: Are D classes proper reference types?

2021-06-27 Thread Mathias LANG via Digitalmars-d-learn
On Sunday, 27 June 2021 at 08:41:27 UTC, kinke wrote: On Sunday, 27 June 2021 at 07:54:38 UTC, Ola Fosheim Grøstad wrote: [AFAIK, most C++ implementations put the - of course totally incompatible - *C++* TypeInfo into vtable slot -1.] Actually my understanding is that it's part of the ABI: Eac

Re: semi-final switch?

2021-06-17 Thread Mathias LANG via Digitalmars-d-learn
On Thursday, 17 June 2021 at 21:41:28 UTC, Steven Schveighoffer wrote: A final switch on an enum complains if you don't handle all the enum's cases. I like this feature. However, sometimes the data I'm switching on is coming from elsewhere (i.e. a user), and while I want to enforce that the d

Re: Missing stacktrace on memory allocation failure

2021-06-02 Thread Mathias LANG via Digitalmars-d-learn
On Wednesday, 2 June 2021 at 17:52:12 UTC, mw wrote: On Thursday, 12 November 2020 at 13:16:21 UTC, Steven Schveighoffer wrote: On 11/12/20 4:22 AM, Per Nordlöw wrote: Why don't I get a stack trace on Memory allocation exceptions? In my case I only get: src/core/exception.d(647): [unittest] M

Re: "this" as default parameter for a constructor.

2021-04-13 Thread Mathias LANG via Digitalmars-d-learn
On Sunday, 11 April 2021 at 20:38:10 UTC, Pierre wrote: Hi, I have a class with a reference to the parent object and a constructor that has the parent as parameter class foo { this ( foo p /* , other params */ ) { parent = p; } foo parent; } Of cause,

Re: using dub and -checkaction=context

2021-01-18 Thread Mathias LANG via Digitalmars-d-learn
On Sunday, 17 January 2021 at 20:42:06 UTC, Steven Schveighoffer wrote: On 1/17/21 2:27 PM, Anonymouse wrote: On Sunday, 17 January 2021 at 15:41:45 UTC, Steven Schveighoffer wrote: I'm trying to run unittests using `dub test`, and I wanted to use the new -checkaction=context feature to avoid h

Re: Vibe.d build on LDC error

2020-11-06 Thread Mathias LANG via Digitalmars-d-learn
On Friday, 6 November 2020 at 05:52:56 UTC, Vino wrote: Hi All, When we try to build vide.d using ldc (dub build) we are getting the below error, openssl is already been installed (OpenSSL 1.0.2j-fips 26 Sep 2016), hence request your help on the same. openssl.d:84: error: undefined refer

Re: Recommended way to use __FILE__/__LINE__ etc.

2020-10-22 Thread Mathias LANG via Digitalmars-d-learn
On Thursday, 22 October 2020 at 16:03:45 UTC, H. S. Teoh wrote: On Thu, Oct 22, 2020 at 03:32:57PM +, Andrey Zherikov via Digitalmars-d-learn wrote: There are two ways how __FILE__, __LINE__ etc. can se used in function parameters: as regular parameters and as template parameters: [...] W

Re: More elaborate asserts in unittests?

2020-10-21 Thread Mathias LANG via Digitalmars-d-learn
On Wednesday, 21 October 2020 at 22:48:04 UTC, IGotD- wrote: On Wednesday, 21 October 2020 at 22:41:42 UTC, Adam D. Ruppe wrote: try compiling with dmd -checkaction=context Thanks, that was simple and it worked. Speaking of this, shouldn't this be documented here for example. https://dlang

Re: cannot call impure function

2020-10-04 Thread Mathias LANG via Digitalmars-d-learn
On Sunday, 4 October 2020 at 18:02:11 UTC, Michael wrote: On Sunday, 4 October 2020 at 17:43:13 UTC, Michael wrote: [...] I used the dmg file: dmd.2.094.0.dmg I reinstalled using the installation script (install.sh) and now it works. Still don't know why the dmg-based intstallation did not w

Re: cannot call impure function

2020-10-04 Thread Mathias LANG via Digitalmars-d-learn
On Sunday, 4 October 2020 at 17:05:33 UTC, Michael wrote: On Sunday, 4 October 2020 at 17:01:44 UTC, Paul Backus wrote: On Sunday, 4 October 2020 at 16:48:24 UTC, Michael wrote: Dear all, Sorry for the potentially stupid question, but I'm a complete newbie to D. Why does compiling the followi

Re: Taking arguments by value or by reference

2020-10-04 Thread Mathias LANG via Digitalmars-d-learn
On Sunday, 4 October 2020 at 14:26:43 UTC, Anonymouse wrote: [...] I mostly really only want a read-only view of the struct, and whether a copy was done or not is academic. However, profiling showed (what I interpret as) a lot of copying being done in release builds specifically. https://i.

Re: default arguments for const ref parameters in extern C++ functions

2020-09-14 Thread Mathias LANG via Digitalmars-d-learn
On Monday, 14 September 2020 at 18:58:44 UTC, 60rntogo wrote: On Monday, 14 September 2020 at 17:11:59 UTC, k2aj wrote: AFAIK the only way to have default ref arguments is to use a global variable: --- extern(C++) struct Foo { int x; } immutable foo1 = Foo(1); extern(C++) void fun(const ref F

Re: in; scope; scope ref; DIP1000; documentation

2020-08-28 Thread Mathias LANG via Digitalmars-d-learn
On Thursday, 27 August 2020 at 18:49:19 UTC, James Blachly wrote: Peeling off from Mathias Lang's thread in General about making 'in' useful, for some novice questions: 1. The thread involves 'in' qualifier. Documentation (https://dlang.org/spec/function.html#param-storage) indicates that `i

Re: Which version of DMD does GDC 10 target

2020-08-19 Thread Mathias LANG via Digitalmars-d-learn
On Thursday, 20 August 2020 at 05:49:29 UTC, Arun wrote: On Thursday, 20 August 2020 at 05:07:28 UTC, H. S. Teoh wrote: On Thu, Aug 20, 2020 at 04:28:41AM +, Arun via Digitalmars-d-learn wrote: Which version of DMD is GDC 10 based on? Compile the following D program to find out: - st

Re: How import DUB packcages directly and compile with DMD without use dub.exe?

2020-07-16 Thread Mathias LANG via Digitalmars-d-learn
On Friday, 17 July 2020 at 01:27:09 UTC, Marcone wrote: On Thursday, 16 July 2020 at 11:52:39 UTC, Andre Pany wrote: On Thursday, 16 July 2020 at 11:06:01 UTC, Marcone wrote: I just want import in file and run with dmd. Execute dub build with verbose output. You will find the info how dub is

Re: Interfacing with C++ std::shared_ptr and std::unique_ptr

2020-06-10 Thread Mathias LANG via Digitalmars-d-learn
On Wednesday, 10 June 2020 at 06:43:24 UTC, Andre Pany wrote: Hi, I would like to interface with the library https://github.com/NTNU-IHB/FMI4cpp and have following class definitions in the header file: ``` c++ namespace fmi4cpp { template class fmu_base { public: const

Re: Dub platform probes

2020-05-27 Thread Mathias LANG via Digitalmars-d-learn
On Thursday, 28 May 2020 at 02:28:07 UTC, Tim wrote: On Wednesday, 27 May 2020 at 21:17:54 UTC, Andre Pany wrote: I read through the source code. The probe file is created here https://github.com/dlang/dub/blob/master/source/dub/compilers/utils.d#L296 The function getTempFile determines a new ra

Re: How to target ldc compiler only in dub

2020-05-26 Thread Mathias LANG via Digitalmars-d-learn
On Tuesday, 26 May 2020 at 22:28:14 UTC, data pulverizer wrote: Hi, I am trying to build a package to target LDC compiler only. I have both dmd and ldc2 (1.18.0) installed on my system. The dub file is: ``` { "authors": [ "Me" ], "copyright": "Copyrigh

Re: Error running concurrent process and storing results in array

2020-05-05 Thread Mathias LANG via Digitalmars-d-learn
On Wednesday, 6 May 2020 at 03:41:11 UTC, data pulverizer wrote: Is there something I need to do to wait for each thread to finish computation? Yeah, you need to synchronize so that your main thread wait on all the other threads to finish. Look up `Thread.join`. Yes, that's exactly what I

Re: Error running concurrent process and storing results in array

2020-05-05 Thread Mathias LANG via Digitalmars-d-learn
On Wednesday, 6 May 2020 at 03:25:41 UTC, data pulverizer wrote: [...] The problem here is that `process` is a delegate, not a function. The compiler *should* know it's a function, but for some reason it does not. Making the function static, or moving it outside of the scope of main, will fi

Re: odd atomicOp errors from vibe-core

2020-04-10 Thread Mathias LANG via Digitalmars-d-learn
On Friday, 10 April 2020 at 03:26:04 UTC, Steven Schveighoffer wrote: On 4/9/20 11:22 PM, Stefan Koch wrote: On Friday, 10 April 2020 at 01:54:14 UTC, Steven Schveighoffer wrote: I'm building a library that uses vibe-core as an indirect dependency. Specifically, I'm testing the library with dub

Re: Fixing race issues the right way

2020-04-05 Thread Mathias LANG via Digitalmars-d-learn
On Sunday, 5 April 2020 at 22:24:27 UTC, solidstate1991 wrote: My game engine is currently broken due to some race issue I don't really know how to resolve. It seems that the compiler tries to skip instructions that are not locked with a `writeln()` or something similar. Usually I can safely

Re: How to deploy on GitHub pages

2020-03-31 Thread Mathias Lang via Digitalmars-d-learn
On Tuesday, 31 March 2020 at 12:52:09 UTC, Ahmat wrote: Hi all, I want to use vibe.d for my personal website hosted on Github pages. I am not familiar with vibe.d and I am confused about how to approach this. Any suggestions, ideas ? I will appreciate your help. You can't. Vibe.d is a serv

Re: @future attribute / @future keyword?

2020-03-19 Thread Mathias Lang via Digitalmars-d-learn
On Wednesday, 18 March 2020 at 14:23:28 UTC, Steven Schveighoffer wrote: Honestly, I think that concept was never fully implemented (or maybe followed properly). Simply because there has not been much complaint about symbols being added "too quickly". 99.99% of the time, you add a symbol to

Re: " include imported modules in the compilation " should exclude di file

2020-03-18 Thread Mathias Lang via Digitalmars-d-learn
On Monday, 9 March 2020 at 13:55:08 UTC, Calvin P wrote: The current compiler "-i=module_name" option will include imported modules as source code. When the module define from di file extension, I think compiler should avoid treat it as source file. What do you think? Sounds sensible. Can

Re: DMD: Is it possible change compile time errors to runtime errors in Dlang?

2020-03-05 Thread Mathias Lang via Digitalmars-d-learn
On Friday, 6 March 2020 at 04:56:28 UTC, Marcone wrote: Is it possible change compile time errors to runtime errors in Dlang? If yes, how can I make it? No it's not possible, D is a statically typed language. Why would you want errors that can be caught at compile time to happen at runtimes ?

Re: about const ref

2020-02-11 Thread Mathias Lang via Digitalmars-d-learn
On Tuesday, 11 February 2020 at 07:51:04 UTC, Ferhat Kurtulmuş wrote: I need to be sure about "const ref". Based on the following function, does it mean: Type can be string or an integral type. (a) k1 is not copied on function calls (b) k1 cannot be modified inside function Please correct me

Re: [dub] Passing --DRT-gcopt to dmd

2020-02-03 Thread Mathias Lang via Digitalmars-d-learn
On Friday, 31 May 2019 at 15:41:24 UTC, Anonymouse wrote: On Friday, 31 May 2019 at 15:31:13 UTC, kinke wrote: On Friday, 31 May 2019 at 10:27:44 UTC, Anonymouse wrote: $ grep dflags dub.json "dflags": [ "-lowmem", "--DRT-gcopt=profile:1" ], This should work indeed. I guess it doesn't bec

Re: `This` reference not accessible when overloading an operator?

2020-01-21 Thread Mathias Lang via Digitalmars-d-learn
On Tuesday, 21 January 2020 at 20:48:44 UTC, Enjoys Math wrote: I have an Integer class in integer.d. A RationalNumber class in rational_number.d, and they each import each other (so that could be the issue). However, this is not working: Symbol opBinary(string op : "/")(const Integer z)

Re: DMD docker image

2020-01-19 Thread Mathias Lang via Digitalmars-d-learn
On Friday, 17 January 2020 at 16:43:17 UTC, Jan Hönig wrote: I have created a docker image. However the image size is not small (~500MB). I wonder if others have a suitable dockerfile. All i want is to install the current dmd release. Does somebody have something similar? Does somebody need some

Re: how to copy const struct with indirections to mutable one (of the same type)

2016-11-29 Thread Mathias Lang via Digitalmars-d-learn
On Tuesday, 29 November 2016 at 10:46:04 UTC, drug wrote: I had the following code: ``` import std.algorithm: equal; [...] You are not calling the (identity) opAssign here, but postblit. To call identity opAssign, you need an already constructed instance: ``` Data mutable_data; mutable_dat

Re: Can't understand the application of delegates in toString() functions

2016-11-07 Thread Mathias Lang via Digitalmars-d-learn
On Monday, 7 November 2016 at 16:22:17 UTC, Heisenberg wrote: Hi there. I'm currently following Ali Çehreli's "Programming in D" book and I can't seem to be able to wrap my head around the of delegates in the toString() functions.. http://ddili.org/ders/d.en/lambda.html (Bottom of the page)

Re: Best way to clear dynamic array for reuse

2016-07-13 Thread Mathias Lang via Digitalmars-d-learn
On Wednesday, 13 July 2016 at 12:05:12 UTC, rikki cattermole wrote: On 13/07/2016 11:59 PM, Miguel L wrote: The options would be: a=[]; a.length=0; a=null; ... any other? Can you help me please? All of those "options" do the same thing, remove all references to that data. No they don't. T

Re: Where does one post a proposal for a language change?

2016-07-12 Thread Mathias Lang via Digitalmars-d-learn
On Tuesday, 12 July 2016 at 16:45:18 UTC, DLearner wrote: General/Issues/or... P.R. to this repository: https://github.com/dlang/DIPs

Re: Diff between function and delegate

2016-06-27 Thread Mathias Lang via Digitalmars-d-learn
On Monday, 27 June 2016 at 19:34:06 UTC, "Smoke" Adams wrote: I have alias fnc = void function(Object); alias del = void delegate(); Does func avoid the GC? I am passing in this to Object so I don't technically need a delegate or a "context". I want to be sure that I'm actually gaining someth

Re: Is there anyway to make opApply @nogc?

2016-06-20 Thread Mathias Lang via Digitalmars-d-learn
On Monday, 20 June 2016 at 14:08:58 UTC, Gary Willoughby wrote: Is there any way to make opApply @nogc? or provide the same foreach functionality without implementing a range interface? I want to iterate over a piece of memory using a pointer. I thought about using opSlice but that doesn't pro

Re: Need help with delegates and vibed

2016-03-19 Thread Mathias Lang via Digitalmars-d-learn
On Wednesday, 16 March 2016 at 20:08:40 UTC, Suliman wrote: I can't understand how to get works delegates works from this doc http://vibed.org/api/vibe.http.client/requestHTTP I see example, but when I am looking on Prototypes I really can't figure how to use them. For example what does this

Re: size_t index=-1;

2016-03-19 Thread Mathias Lang via Digitalmars-d-learn
On Wednesday, 16 March 2016 at 21:49:05 UTC, Steven Schveighoffer wrote: No, please don't. Assigning a signed value to an unsigned (and vice versa) is very useful, and there is no good reason to break this. -Steve I'm not talking about removing it completely. The implicit conversion should

Re: size_t index=-1;

2016-03-19 Thread Mathias Lang via Digitalmars-d-learn
On Wednesday, 16 March 2016 at 20:11:41 UTC, Steven Schveighoffer wrote: On 3/16/16 2:40 PM, Laeeth Isharc wrote: should it be a compiler warning to assign a negative literal to an unsigned without a cast ? Why? They implicitly convert. int x = -1; uint y = x; I don't see a difference betw

Re: size_t index=-1;

2016-03-18 Thread Mathias Lang via Digitalmars-d-learn
On Wednesday, 16 March 2016 at 18:40:56 UTC, Laeeth Isharc wrote: should it be a compiler warning to assign a negative literal to an unsigned without a cast ? yes it should. https://issues.dlang.org/show_bug.cgi?id=3468

Re: Issues

2016-02-22 Thread Mathias Lang via Digitalmars-d-learn
On Monday, 22 February 2016 at 22:56:26 UTC, Andre wrote: I was wondering how people in this D community think about the number of issues with NEW status... NEW just means 'not resolved'. Things are rarely assigned, and usually go straight from 'NEW' to 'RESOLVED'. An intermediate status,

Re: Declaring extern(C) declarations with template mixins

2016-01-12 Thread Mathias Lang via Digitalmars-d-learn
On Tuesday, 12 January 2016 at 21:22:46 UTC, Jacob Carlborg wrote: Is this supposed to work: template Foo() { extern(C) int printf(in char*, ...); } mixin Foo; void main() { printf("foo\n"); } It fails with a linker error, undefined symbol, due to not applying C mangling: Undefined

Re: goroutines vs vibe.d tasks

2015-07-01 Thread Mathias Lang via Digitalmars-d-learn
On Tuesday, 30 June 2015 at 15:18:36 UTC, Jack Applegame wrote: Just creating a bunch (10k) of sleeping (for 100 msecs) goroutines/tasks. Compilers go: go version go1.4.2 linux/amd64 vibe.d: DMD64 D Compiler v2.067.1 linux/amd64, vibe.d 0.7.23 Code go: http://pastebin.com/2zBnGBpt vibe

Re: Compilation with dub + dmd: out of memory

2015-02-10 Thread Mathias LANG via Digitalmars-d-learn
On Tuesday, 10 February 2015 at 11:24:21 UTC, Vlasov Roman wrote: I have the quite computer with 2 GB RAM. At compilation with dub and dmd of small project this pair eating about 1.4~1.5 GB RAM. I solve this probleb by connecting swap partition, but it calls some freezes + it take ~10% of swap,

Re: ddoc template error

2015-01-20 Thread Mathias LANG via Digitalmars-d-learn
On Tuesday, 20 January 2015 at 08:55:58 UTC, BlackEdder wrote: Solved it. I had a _fromJSON comment somewhere else in the file and the underscore causes ddoc to fail If you could reduce it to a manageable size and post it to https://issues.dlang.org/ that'll be super cool :)

Re: rebind of const class variables

2015-01-20 Thread Mathias LANG via Digitalmars-d-learn
On Tuesday, 20 January 2015 at 09:29:46 UTC, qqiang wrote: I am writing a tree data structure, and I have the following code: ```D final class Node { private { int val_; Node parent_; Node left_; Node right_; } @property const(Node) maximum() con

Re: Why do std.traits use template foo(args...) instead of foo(alias arg) ?

2014-12-18 Thread Mathias LANG via Digitalmars-d-learn
On Thursday, 18 December 2014 at 16:10:31 UTC, Dicebot wrote: On Thursday, 18 December 2014 at 15:48:02 UTC, Mathias LANG wrote: An exemple being fullyQualifiedName: https://github.com/D-Programming-Language/phobos/blob/master/std/traits.d#L415 I don't get this pattern. Is it documented somewhe

Why do std.traits use template foo(args...) instead of foo(alias arg) ?

2014-12-18 Thread Mathias LANG via Digitalmars-d-learn
An exemple being fullyQualifiedName: https://github.com/D-Programming-Language/phobos/blob/master/std/traits.d#L415 I don't get this pattern. Is it documented somewhere ?

Re: [static] foreach scope, template declaration ?

2014-09-26 Thread Mathias LANG via Digitalmars-d-learn
On Thursday, 25 September 2014 at 23:08:53 UTC, SlomoTheBrave wrote: a way around this is not to use anySatisfy nor the template, for example this works as expected: [...] My problem is that in this example, attributes are in the same order as the parameter. But this come from a code genera

[static] foreach scope, template declaration ?

2014-09-25 Thread Mathias LANG via Digitalmars-d-learn
I'm a bit puzzled with the following behavior: import std.typetuple, std.traits; struct UDAStruct { string identifier; } class MyClass { @(UDAStruct("p1"), UDAStruct("p2"), UDAStruct("P3")) // P3 is a typo void func(int p1, string p2, float p3) {} } unittest { alias Fu

Re: UFCS doesn't work in some cases

2014-09-09 Thread Mathias LANG via Digitalmars-d-learn
On Tuesday, 9 September 2014 at 17:58:16 UTC, Danyal Zia wrote: As far as I know, UFCS are designed to make it easy to extend the class for specific applications, however, without the ability to use UFCS for those cases, it limits its usefulness. Are these oversights/bugs? Or is their any ratio

Re: DDoc and private members / mixins / UDAs

2014-06-25 Thread Mathias LANG via Digitalmars-d-learn
On Wednesday, 25 June 2014 at 18:49:27 UTC, Stefan Frijters wrote: Let me preface this by admitting that I'm not sure I'm using the DDoc functionality properly at all, so let me know if my questions are bogus. Is it possible to: - Add private members to documentation? - Have DDoc do its thing

Re: DUB linking problem on WinXp

2014-06-19 Thread Mathias Lang via Digitalmars-d-learn
On Thursday, 19 June 2014 at 12:18:54 UTC, Orfeo wrote: Under WinXp I got the following AFAIK, D is not officially supported on Win XP. That's probably why you don't have a meaningful stacktrace or error message.