Re: visibility of private Class C in module named "C"; private variables in modules

2020-12-26 Thread Mike Parker via Digitalmars-d-learn
On Saturday, 26 December 2020 at 15:58:30 UTC, kdevel wrote: package class Private { void foo () { __PRETTY_FUNCTION__.writeln; } } import Private; auto p = new Private; // works, but Private.Private is private ?!? You've declared `Private` as `package`.

Re: gdb + Windows 64: No debugging symbols found

2020-12-26 Thread Mike Parker via Digitalmars-d-learn
On Saturday, 26 December 2020 at 11:55:58 UTC, Виталий Фадеев wrote: Problem is: $ gdb ./app.exe GNU gdb (GDB) 9.2 ... (No debugging symbols found in ./app.exe) What is a right way to build .exe and debug with gdb ? The version of gdb that ships with MSYS is probably going

Re: How to store a pointer to class contructor

2020-12-24 Thread Mike Parker via Digitalmars-d-learn
On Thursday, 24 December 2020 at 11:15:28 UTC, Dmitriy Asondo wrote: Is there any way, for example on compile step, to get class name from class pointer? To automate generation of factory via template At compile time, you'd get it from the type, not the reference: typeid(T).name;

Re: How to store a pointer to class contructor

2020-12-24 Thread Mike Parker via Digitalmars-d-learn
On Thursday, 24 December 2020 at 10:33:00 UTC, Dmitriy Asondo wrote: The idea is to store somewhere services (classes) first and only when the app need - instantiate services for app/thread/http-request (as option) and provide values to constructors via DI There's `Object.factory`, which

Re: Can I output strings using core.stdc.stdio?

2020-12-23 Thread Mike Parker via Digitalmars-d-learn
On Wednesday, 23 December 2020 at 08:45:15 UTC, Godnyx wrote: Yep and I find it out! It won't work with templates and/or variadic function parameters. It says that the variable can't be read at compile time (so I can't cast it) or it will work but it will give me a segmentation fault (lol

Re: Trying to understand multidimensional arrays in D

2020-12-22 Thread Mike Parker via Digitalmars-d-learn
On Tuesday, 22 December 2020 at 15:31:06 UTC, Rekel wrote: Don't take that as a defence of changing pointer syntax by the way, just noting I think the argument pointers and arrays should be defined using a similar syntax is not consistent when thinking about indexing & dereferencing.

Re: Trying to understand multidimensional arrays in D

2020-12-22 Thread Mike Parker via Digitalmars-d-learn
On Tuesday, 22 December 2020 at 13:59:54 UTC, Rekel wrote: I am curious by the way, what do you think of the [][4]Row suggestion I gave? In a way you'd have your  & could eat it too, i think ^^ (Still a strange saying to me) Currently, D's variable declaration syntax is consistent and,

Re: Flag & byLine confusion.

2020-12-20 Thread Mike Parker via Digitalmars-d-learn
On Sunday, 20 December 2020 at 15:18:44 UTC, Rekel wrote: By the way, where can I see Flag is (/ will be?) deprecated? It doesn't show in the library reference, however I may be looking in the wrong place. It hasn't been yet.

Re: Flag & byLine confusion.

2020-12-20 Thread Mike Parker via Digitalmars-d-learn
On Sunday, 20 December 2020 at 14:07:56 UTC, Rekel wrote: The template parameter serves to make Flag!"foo" a distinct type from Flag!"bar". Does this mean other flag yes's will not be accepted? Yes. https://dlang.org/spec/operatoroverloading.html#dispatch Also regarding the other

Re: Flag & byLine confusion.

2020-12-19 Thread Mike Parker via Digitalmars-d-learn
On Saturday, 19 December 2020 at 23:16:00 UTC, Rekel wrote: Most confusing was the way the documentation (website & in-editor) used; 1. Yes.keepTerminator 2. KeepTerminator.yes 3. Flag!"keepTerminator".yes Your confusion arises from the fact that KeepTerminator is combining multiple

Re: Getting the source text of an expression

2020-12-17 Thread Mike Parker via Digitalmars-d-learn
On Thursday, 17 December 2020 at 21:40:09 UTC, Dave P. wrote: Very cool! Where can I read about what an alias as a template parameter does? https://dlang.org/spec/template.html#aliasparameters https://github.com/PhilippeSigaud/D-templates-tutorial

Re: extern(C) and name mangling

2020-12-15 Thread Mike Parker via Digitalmars-d-learn
On Wednesday, 16 December 2020 at 04:45:34 UTC, Dave P. wrote: Oh interesting, so I only need extern(C) for declaring symbols I’m linking to and for symbols I want to export to C. I had sort of assumed that D might have different calling conventions for different things, but that makes

Re: extern(C) and name mangling

2020-12-15 Thread Mike Parker via Digitalmars-d-learn
On Tuesday, 15 December 2020 at 22:04:12 UTC, Dave P. wrote: I can’t find this in the spec, but from experimentation it seems like extern(C) only affects name mangling of functions at the top level scope. Thus extern(C) function templates would be mangled differently, but still use the C

Re: UFCS functions with both pointers and refs

2020-12-15 Thread Mike Parker via Digitalmars-d-learn
On Sunday, 13 December 2020 at 19:02:34 UTC, Dave P. wrote: On Sunday, 13 December 2020 at 18:44:20 UTC, Mike Parker wrote: On Sunday, 13 December 2020 at 18:31:54 UTC, Dave P. wrote: Do I have to write both and have one forward to the other for more complicated functions? For free

Re: UFCS functions with both pointers and refs

2020-12-13 Thread Mike Parker via Digitalmars-d-learn
On Sunday, 13 December 2020 at 18:31:54 UTC, Dave P. wrote: If I define a method on a type, then I can call it both through a pointer and through a reference and the compiler does the right thing. Eg: struct Foo { int x; void fooey(){ x++; } void report(){

Re: How to unit-test a phobos module?

2020-11-25 Thread Mike Parker via Digitalmars-d-learn
On Wednesday, 25 November 2020 at 21:36:36 UTC, Q. Schroll wrote: [1] https://wiki.dlang.org/Building_under_Windows You might try Digger. That will hide all the tedious bits. https://code.dlang.org/packages/digger

Re: why is "hello".writeln considered bad?

2020-11-20 Thread Mike Parker via Digitalmars-d-learn
On Friday, 20 November 2020 at 10:03:18 UTC, Daniel Kozak wrote: I remember days when I liked UFCS too . Unfortunately it is not so awesome when you use it with IDE. So I am now avoiding UFCS as much as possible and it is a much better experience for me. Doesn't bother me.

Re: why is "hello".writeln considered bad?

2020-11-19 Thread Mike Parker via Digitalmars-d-learn
On Friday, 20 November 2020 at 07:39:10 UTC, norm wrote: I was reading some posts and this was presented as a snippet of code and was immediately flagged as bad practice. Eh, I wouldn't quite put it that way. If we're thinking of the same thread, one person said he thought it was a bad

Re: betterC question

2020-11-18 Thread Mike Parker via Digitalmars-d-learn
On Thursday, 19 November 2020 at 00:20:50 UTC, Dibyendu Majumdar wrote: On Thursday, 19 November 2020 at 00:18:54 UTC, rikki cattermole wrote: You don't need the brackets to call a function (and with a little help from UFCS): void main() { import std.stdio;

Re: Two "references" to dynamic array, why not change both when reallocating?

2020-11-11 Thread Mike Parker via Digitalmars-d-learn
On Wednesday, 11 November 2020 at 10:17:09 UTC, zack wrote: I am new to D. Appending to an array can lead to reallocation, that's clear. But why is the "reference" b not changed accordingly to the new position and still points to "old" memory? Why is b not also changed when reallocating array

Re: Return values from auto function

2020-11-06 Thread Mike Parker via Digitalmars-d-learn
On Friday, 6 November 2020 at 15:06:18 UTC, Andrey Zherikov wrote: To clarify my statement: Yes, Result!void and Result!int are different types but I couldn't find a way to implicitly convert one to another. You can't. Structs do not implicitly convert to each other, templated or otherwise.

Re: Source code folder naming convention?

2020-11-04 Thread Mike Parker via Digitalmars-d-learn
On Wednesday, 4 November 2020 at 11:15:33 UTC, Vladimirs Nordholm wrote: Hello. Is there a "best practice" of what the source folder should be called? I commonly see either `source` or `src` in GitHub projects, but cannot find any formal best practice naming convention. dub looks for both

Re: What is the difference between enum and shared immutable?

2020-10-28 Thread Mike Parker via Digitalmars-d-learn
On Thursday, 29 October 2020 at 00:55:29 UTC, matheus wrote: On Wednesday, 28 October 2020 at 22:07:06 UTC, H. S. Teoh wrote: ... (This is why it's a bad idea to use enum with an array literal, because every time it's referenced you get a new copy of the array.) ... Could you please give an

Re: Getting Qte5 to work

2020-10-28 Thread Mike Parker via Digitalmars-d-learn
On Wednesday, 28 October 2020 at 07:50:27 UTC, Josh Dredge wrote: developers would love to be working with! I will give Gtk a go too - I've never programmed with it, but I used Ubuntu alot back in the day and never really liked applications that used it, but maybe its more responsive on

Re: winapi, dll

2020-10-15 Thread Mike Parker via Digitalmars-d-learn
On Thursday, 15 October 2020 at 20:59:10 UTC, Atmosfear wrote: I use online DMD. I'll try VS 2019 with the VisualD. That's the issue, then. The online versions of DMD run on Linux. You don't need VisualD for this. Just plain old dmd in a text editor will do.

Re: How to add an additional config dir in DUB under source?

2020-10-12 Thread Mike Parker via Digitalmars-d-learn
On Tuesday, 13 October 2020 at 05:13:18 UTC, Mike Parker wrote: not available. The very first restriction on CTFE is this: "The function source code must be available to the compiler. Functions which exist in the source code only as extern declarations cannot be executed in CTFE." Forgot

Re: How to add an additional config dir in DUB under source?

2020-10-12 Thread Mike Parker via Digitalmars-d-learn
On Monday, 12 October 2020 at 22:31:53 UTC, tastyminerals wrote: I wonder why and what am I doing wrong? This: readText("conf.toml"); "stringImportPath" (dmd's -J command line option) is specifically for D's import expression (which is different from the import statement, e.g., `import

Re: It is possible to substract 5 from 3 unsigned integer

2020-10-06 Thread Mike Parker via Digitalmars-d-learn
On Tuesday, 6 October 2020 at 12:24:56 UTC, Alaindevos wrote: Is that the expected behavior of the programmer? Opinions can differ. Feel free to elaborate. It's expected behavior: "If both operands are of integral types and an overflow or underflow occurs in the computation, wrapping will

Re: question on dub and postgresql

2020-10-05 Thread Mike Parker via Digitalmars-d-learn
On Monday, 5 October 2020 at 15:08:54 UTC, Alaindevos wrote: Yet it would be nice to know why i can't iterate directly over answer using foreach. Looking at the implementation of the `Answer` type [1], I see no way to create a range or a slice, and no `opApply`. So you'll have to ask the

Re: question on dub and postgresql

2020-10-05 Thread Mike Parker via Digitalmars-d-learn
On Monday, 5 October 2020 at 09:05:16 UTC, Alaindevos wrote: A name dependency solution is at least vage. How do I install , https://github.com/denizzzka/dpq2 on unix so in the code i write the .d files of that library and after compilation linked to the libary shared objects. For that shared

Re: Safe to remove AA elements while iterating over it via .byKeyValue?

2020-09-29 Thread Mike Parker via Digitalmars-d-learn
On Sunday, 27 September 2020 at 13:02:04 UTC, Per Nordlöw wrote: Is it safe to remove AA-elements from an `aa` I'm iterating over via aa.byKeyValue? I'm currently doing this: foreach (ref kv; aa.byKeyValue) { if (pred(kv.key)) aa.remove(kv.key); // ok? } if

Re: Any way to tell if an object is inside another class?

2020-09-28 Thread Mike Parker via Digitalmars-d-learn
On Monday, 28 September 2020 at 14:23:12 UTC, Ruby The Roobster wrote: On Monday, 28 September 2020 at 14:22:34 UTC, Ruby The Roobster wrote: I meant User Defined types. not UDAs. Anyways, the whole thing is me trying to find a hacky workaround that allows something similar to multiple alias

Re: conflicting alias in package module

2020-09-26 Thread Mike Parker via Digitalmars-d-learn
On Saturday, 26 September 2020 at 22:43:10 UTC, 60rntogo wrote: OK, sure. It's just that the motivation behind doing public imports in package.d is that I can write "import pack" instead of "import pack.foo". I guess it simply doesn't work within the package itself. package.d is for your

Re: Why private methods cant be virtual?

2020-09-22 Thread Mike Parker via Digitalmars-d-learn
On Tuesday, 22 September 2020 at 14:19:09 UTC, Steven Schveighoffer wrote: On 9/22/20 10:11 AM, Arafel wrote: This is a very good guess. Specifically, I think classes (and the mechanisms for inner classes and anonymous classes) were added to D1 to allow porting of JWT to D. Classes

Re: How to implement fastcall ?

2020-09-21 Thread Mike Parker via Digitalmars-d-learn
On Monday, 21 September 2020 at 11:14:06 UTC, Виталий Фадеев wrote: How to implement fastcall ? ( stdcall is calling convention for pass function arguments via registers ) The supported linkage attributes are here: https://dlang.org/spec/attribute.html#linkage `extern(Windows)` is stdcall,

Re: create and initialise array

2020-09-19 Thread Mike Parker via Digitalmars-d-learn
On Saturday, 19 September 2020 at 21:53:34 UTC, mw wrote: On Thursday, 20 June 2019 at 07:57:25 UTC, KnightMare wrote: imo NaN is useless, weird and unusual coz integrals and pointers are "all bits zeroes" but float and chars are "all bits ones". WTF? its strange that bool.init is false in

Re: DDoc generation

2020-09-19 Thread Mike Parker via Digitalmars-d-learn
On Friday, 18 September 2020 at 13:35:05 UTC, Russel Winder wrote: On Fri, 2020-09-18 at 09:02 -0400, Steven Schveighoffer via Digitalmars-d- learn wrote: […] it ddoc files, and compile those along with your application. https://dlang.org/spec/ddoc.html#using_ddoc_for_other_documentation

Re: dub: Is it possible to have a library target and depend on it in the same dub config?

2020-09-18 Thread Mike Parker via Digitalmars-d-learn
On Friday, 18 September 2020 at 12:28:30 UTC, wjoe wrote: 2 issues though. - It doesn't build the library automatically, and You'll have to invoke dub once for each config. Just slap both commands in a script. - Linking fails because error: ld: cannot find -llib Built it manually via dub

Re: dub: Is it possible to have a library target and depend on it in the same dub config?

2020-09-18 Thread Mike Parker via Digitalmars-d-learn
On Friday, 18 September 2020 at 11:38:14 UTC, wjoe wrote: Something like this: configuration "lib" { targetType "dynamicLibrary" sourceDir "source/lib/" } configuration "app" { targetType "executable" sourceFiles "source/app.d" linkWith "lib" } I found subConfiguration in the docs

Re: enum and const or immutable ‘variable’ whose value is known at compile time

2020-09-17 Thread Mike Parker via Digitalmars-d-learn
On Thursday, 17 September 2020 at 22:25:47 UTC, claptrap wrote: If enum means manifiest constant, or compile time constant, then it makes more sense, as you allude to in a later post. But 'enum' is a terrible name for that and I dont think my brain will ever stop finding it incongruous. And

Re: enum and const or immutable ‘variable’ whose value is known at compile time

2020-09-17 Thread Mike Parker via Digitalmars-d-learn
On Thursday, 17 September 2020 at 13:25:08 UTC, Mike Parker wrote: Well, I was already using anonymous enums for compile-time And, I should add, I have *never* seen C enums as an enumerated list of values. I've always seen them as an alternative for #defined constants because they're

Re: enum and const or immutable ‘variable’ whose value is known at compile time

2020-09-17 Thread Mike Parker via Digitalmars-d-learn
On Thursday, 17 September 2020 at 13:13:46 UTC, Simen Kjærås wrote: To quote Bill Baxter from way back when (https://forum.dlang.org/post/fjdc4c$2gft$1...@digitalmars.com): > Why does: > final int x = 3; > make any more intuitive sense than: > enum int x = 3; > ? There are these

Re: enum and const or immutable ‘variable’ whose value is known at compile time

2020-09-17 Thread Mike Parker via Digitalmars-d-learn
On Thursday, 17 September 2020 at 09:44:20 UTC, claptrap wrote: Seriously how it's implemented is irrelevant. And to be clear, my point wasn't about how it's implemented. My point was that: enum { foo = 10; } and enum foo = 10; Are effectively the same thing, whether it's implemented

Re: enum and const or immutable ‘variable’ whose value is known at compile time

2020-09-17 Thread Mike Parker via Digitalmars-d-learn
On Thursday, 17 September 2020 at 09:44:20 UTC, claptrap wrote: Names are important, principle of least astonishment and all that, pretty much everyone coming to D is going be WTF in learning about that. And if you keep overloading existing keywords with more and more meanings the code gets

Re: enum and const or immutable ‘variable’ whose value is known at compile time

2020-09-16 Thread Mike Parker via Digitalmars-d-learn
On Thursday, 17 September 2020 at 00:32:40 UTC, Cecil Ward So can the result of declaring certain things with enum ever have an _address_ then? (According to legit D code that is, never mind the underlying implementation details, which may not be observable) No. Think of it as a named

Re: importing a symbol without specifying a subpackage name

2020-09-16 Thread Mike Parker via Digitalmars-d-learn
On Wednesday, 16 September 2020 at 13:30:57 UTC, 60rntogo wrote: then saying "import foo : Bar;" yields an error "module foo is in file 'foo.d' which cannot be read". I'm curious, how is this behavior achieved in the standard library? To expand on Adam's reply:

Re: Problem with gfm.math.matrix (some gamedevs out there ?)

2020-09-03 Thread Mike Parker via Digitalmars-d-learn
On Thursday, 3 September 2020 at 12:36:35 UTC, Thomas wrote: My example code: - import std.stdio; int main() { import gfm.math.matrix; const int width = 800; const int height = 600; auto projectionMatrix = mat4!(float).identity(); auto ratio =

Re: bindbc OpenGL ES

2020-08-31 Thread Mike Parker via Digitalmars-d-learn
On Monday, 31 August 2020 at 14:04:19 UTC, Danny Arends wrote: Don't know exactly where to post this, so I hope the bindbc team will see the post here in learn. I was wondering if it would be possible to have bindbc OpenGL ES bindings ? I can make time for it sometime this week.

Re: How do I statically build a project using DUB?

2020-08-29 Thread Mike Parker via Digitalmars-d-learn
On Sunday, 30 August 2020 at 02:38:52 UTC, Kirill wrote: I am trying to link the GTK library. I have the GTK Runtime installed on Windows 10 pc. Unless things have changed in the last few years, GTK is not intended to be linked statically on Windows. You'll have to figure out how to

Re: Installing D on Fresh Windows 10 machine is a pain

2020-08-27 Thread Mike Parker via Digitalmars-d-learn
On Thursday, 27 August 2020 at 17:34:03 UTC, bachmeier wrote: It would be nice to have a screencast of this for someone that doesn't work often with Windows. There are screenshots in the VS docs, e.g., https://docs.microsoft.com/en-us/visualstudio/install/modify-visual-studio?view=vs-2019

Re: Installing D on Fresh Windows 10 machine is a pain

2020-08-27 Thread Mike Parker via Digitalmars-d-learn
On Thursday, 27 August 2020 at 16:39:05 UTC, Mike Parker wrote: Or maybe better, just go to the 'Individual components', select the latest Windows 10 SDK version, and install it. Or just check the installation folder. For me, it's: C:\Program Files (x86)\Windows

Re: Installing D on Fresh Windows 10 machine is a pain

2020-08-27 Thread Mike Parker via Digitalmars-d-learn
On Thursday, 27 August 2020 at 15:59:51 UTC, Jesse Phillips wrote: Installing D isn't new to me but I haven't really had to do a fresh install for awhile and come from a time when I was installing VS from 2010 and up. VS 2019 Professional is installed on the system. I have installed the C++

Re: Installing D on Fresh Windows 10 machine is a pain

2020-08-27 Thread Mike Parker via Digitalmars-d-learn
On Thursday, 27 August 2020 at 16:35:07 UTC, Mike Parker wrote: It has worked for me every time I've installed it since VS 2015. libucrt.lib should have been installed by the VS installer. Something to check: run the installer again, click the checkbox in corner of the 'Desktop development

Re: Dub can't find and download packages

2020-08-06 Thread Mike Parker via Digitalmars-d-learn
On Wednesday, 5 August 2020 at 17:32:49 UTC, vanaur wrote: My concern is thus the following: I can't add packages to my project, Dub warns me that they are not available. For the example, I try to add this dependency (https://code.dlang.org/packages/pegged) with the following command: dub

Re: Static link of glfw3 library fails for me

2020-07-27 Thread Mike Parker via Digitalmars-d-learn
On Monday, 27 July 2020 at 07:30:42 UTC, John Burton wrote: For reference I got this to work by doing the following :- 1) Installed visual studio build tools. I could not get this to work at all with the linker etc that comes with ldc2. 2) Copied the glfw3.lib vs2019 version file into my

Re: Static link of glfw3 library fails for me

2020-07-26 Thread Mike Parker via Digitalmars-d-learn
On Sunday, 26 July 2020 at 08:28:29 UTC, John Burton wrote: versions "BindGLFW_Static" libs "glfw3" lflags "-L..\\work\\3rdparty\\lib" And by the way, you're going to need to link more libs than glfw3 for a static link. You'll need all of its dependencies, as well (OpenGL32.lib,

Re: Static link of glfw3 library fails for me

2020-07-26 Thread Mike Parker via Digitalmars-d-learn
On Sunday, 26 July 2020 at 08:28:29 UTC, John Burton wrote: And I get the following errors from the link :- lld-link: error: undefined symbol: __GSHandlerCheck lld-link: error: undefined symbol: __security_check_cookie lld-link: error: undefined symbol: __security_cookie I believe that's

Re: How DerelictCL works

2020-07-21 Thread Mike Parker via Digitalmars-d-learn
On Tuesday, 21 July 2020 at 12:00:03 UTC, bioinfornatics wrote: Dear, I would like to use OpenCL in D. Thus I try to use DerelictCL. But I fail to use it I encounter this error message: -- /opt/jonathan/jonathan-dlang_ldc2092/root/usr/include/d/derelict/opencl/constants.di(835):

Re: Send empty assoc array to function

2020-07-09 Thread Mike Parker via Digitalmars-d-learn
On Friday, 10 July 2020 at 03:59:37 UTC, Mike Parker wrote: On Thursday, 9 July 2020 at 21:13:49 UTC, JN wrote: Interesting. Often in D discussion, an argument pops up that the language should be protecting against hidden breakages from API changes. This would be an example of that

Re: Send empty assoc array to function

2020-07-09 Thread Mike Parker via Digitalmars-d-learn
On Thursday, 9 July 2020 at 21:13:49 UTC, JN wrote: Interesting. Often in D discussion, an argument pops up that the language should be protecting against hidden breakages from API changes. This would be an example of that happening. void foo(int[int] bar), someone calls it with a null,

Re: Translating C headers to D: How do I compile it?

2020-06-27 Thread Mike Parker via Digitalmars-d-learn
On Sunday, 28 June 2020 at 04:59:12 UTC, Kirill wrote: Hello. I am learning how to translate C headers to D. But how do I compile it? I am stuck with this. I have 4 files in the same directory: main.d, something.d, some.h, some.c some.h: //header guards int add(int a, int b); some.c:

Re: Garbage collection

2020-06-27 Thread Mike Parker via Digitalmars-d-learn
On Saturday, 27 June 2020 at 11:11:38 UTC, James Gray wrote: I am measuring the memory usage using top from the command line. GC.minimize() does seem to stop the leak. But it doesn't explain why the program isn't releasing essentially all the memory between calls to f (it using around 2GB

Re: Passing iterators into functions

2020-06-25 Thread Mike Parker via Digitalmars-d-learn
On Thursday, 25 June 2020 at 03:35:00 UTC, repr-man wrote: This seems to have to do with the fact that all iterators return their own unique type. Could someone help me understand the reason behind this design and how to remedy my situation? Ranges conform to well-defined interfaces.

Re: When is exception throwing @nogc with -dip1008?

2020-06-22 Thread Mike Parker via Digitalmars-d-learn
On Monday, 22 June 2020 at 13:59:22 UTC, Per Nordlöw wrote: I can't find any docs on DIP-1008. The link https://github.com/dlang/DIPs/blob/master/DIPs/DIP1008.md given in the release notes here Ref: https://dlang.org/changelog/2.079.0.html#dip1008 is broken.

Re: Some questions about strings

2020-06-21 Thread Mike Parker via Digitalmars-d-learn
On Monday, 22 June 2020 at 04:08:10 UTC, Denis wrote: On Monday, 22 June 2020 at 03:31:17 UTC, Ali Çehreli wrote: : string is char[] wstring is wchar[] dstring is dchar[] Got it now. This is the critical piece I missed: I understand the relations between the char types and the UTF encodings

Re: Mixin and imports

2020-06-07 Thread Mike Parker via Digitalmars-d-learn
On Monday, 8 June 2020 at 02:55:25 UTC, jmh530 wrote: In the code below, foo!fabs compiles without issue, but foo!"fabs" does not because the import is not available in the string mixin. If I move the import to the top of the module, then it works. However, then if I move foo to another

Re: DMD 2.092 and DIP 25

2020-05-30 Thread Mike Parker via Digitalmars-d-learn
On Saturday, 30 May 2020 at 16:14:34 UTC, Steven Schveighoffer wrote: This is not about const or not, it's about lifetime management. For example, this would return a pointer to a stack frame that is about to go away: const(char)* foo() { ErrorInfo info; return info.message; } I

Re: DMD 2.092 and DIP 25

2020-05-30 Thread Mike Parker via Digitalmars-d-learn
On Saturday, 30 May 2020 at 07:30:17 UTC, Max Samukha wrote: On Saturday, 30 May 2020 at 07:00:07 UTC, Mike Parker wrote: https://run.dlang.io/is/aOZqww Since 2.067.1: Success and no output Thanks, Max (and you, too, Seb). I had forgotten that run.dlang.io supports compilers going so

Re: DMD 2.092 and DIP 25

2020-05-30 Thread Mike Parker via Digitalmars-d-learn
On Saturday, 30 May 2020 at 07:30:17 UTC, Max Samukha wrote: On Saturday, 30 May 2020 at 07:00:07 UTC, Mike Parker wrote: https://run.dlang.io/is/aOZqww Since 2.067.1: Success and no output Thanks! I forgot that run.dlang.io supports all those old compilers.

DMD 2.092 and DIP 25

2020-05-30 Thread Mike Parker via Digitalmars-d-learn
The following declarations now give a deprecation warning: ```d struct ErrorInfo { private: char[32] _error; char[96] _message; public @nogc nothrow @property: /** Returns the string "Missing Symbol" to indicate a symbol load failure, and the name of a library to

Re: What's the best way to find out which exceptions may be thrown ?

2020-05-27 Thread Mike Parker via Digitalmars-d-learn
On Wednesday, 27 May 2020 at 10:30:36 UTC, wjoe wrote: On Wednesday, 27 May 2020 at 10:01:33 UTC, Mike Parker wrote: Could you please elaborate why checked exceptions are more annoying? For me, it's because they require all functions that touch them to either try/catch or include an

Re: What's the best way to find out which exceptions may be thrown ?

2020-05-27 Thread Mike Parker via Digitalmars-d-learn
On Wednesday, 27 May 2020 at 09:56:07 UTC, wjoe wrote: The problem with catch(Exception) is that it's run time whereas I'd like to know compile time which exception may possibly be thrown. So I take it the only way to find out what may be thrown is to read the source code of the called

Re: What's the best way to find out which exceptions may be thrown ?

2020-05-27 Thread Mike Parker via Digitalmars-d-learn
On Wednesday, 27 May 2020 at 09:42:58 UTC, Mike Parker wrote: On Wednesday, 27 May 2020 at 09:40:08 UTC, wjoe wrote: The compiler will complain that bar(int) isn't nothrow. What's the best way to find out which Exceptions aren't handled inside of foo() for foo to be able to be nothrow

Re: What's the best way to find out which exceptions may be thrown ?

2020-05-27 Thread Mike Parker via Digitalmars-d-learn
On Wednesday, 27 May 2020 at 09:40:08 UTC, wjoe wrote: The compiler will complain that bar(int) isn't nothrow. What's the best way to find out which Exceptions aren't handled inside of foo() for foo to be able to be nothrow without using a 'catch (Exception){}' catch-all?

Re: How to target ldc compiler only in dub

2020-05-26 Thread Mike Parker via Digitalmars-d-learn
On Wednesday, 27 May 2020 at 01:41:47 UTC, data pulverizer wrote: On Wednesday, 27 May 2020 at 01:06:48 UTC, mw wrote: And you can use option dub -v to verify it's calling the correct compiler cmd. Thanks. Is there anyway to verify that the flags I am passing to the compiler are being

Re: How to get the pointer of "this" ?

2020-05-25 Thread Mike Parker via Digitalmars-d-learn
On Monday, 25 May 2020 at 16:26:31 UTC, Vinod K Chandran wrote: Here is my full code. Please take a look. https://pastebin.com/av3nrvtT The error has nothing to do with taking a pointer to `this`. It's suggesting that somewhere in your code you're attempting to use the `this` reference

Re: How to get the pointer of "this" ?

2020-05-25 Thread Mike Parker via Digitalmars-d-learn
On Monday, 25 May 2020 at 08:39:23 UTC, John Burton wrote: I believe that in D *this* is a reference to the object and not a pointer like in C++. So I think that writing might be what you need? No. A class reference is a pointer under the hood. Getting its address will result in a pointer

Re: Storing a reference to the calling object

2020-05-23 Thread Mike Parker via Digitalmars-d-learn
On Saturday, 23 May 2020 at 09:27:46 UTC, Tim wrote: Hi all, I'm a little new to D and I'm wondering how I can store a reference to the calling object. I want to create a reference to an object's parent so that each time I go to update the sprite, it is able to grab its position from the

Re: RtlAdjustPrivilege and NtRaiseHardError

2020-05-22 Thread Mike Parker via Digitalmars-d-learn
On Friday, 22 May 2020 at 19:19:19 UTC, Arsium wrote: Just I tried to launch those functions from win32 api and seems doesn't work "doesn't work" isn't very helpful. Are you seeing compiler errors? Linker errors? Runtime errors? Please describe your problem.

Re: How to use this forum ?

2020-05-20 Thread Mike Parker via Digitalmars-d-learn
On Wednesday, 20 May 2020 at 21:06:35 UTC, welkam wrote: On Wednesday, 20 May 2020 at 20:49:52 This is not a forum but a frontend to a mailing list. Both the forums and the mailing lists are interfaces to newsgroups at news.digitalmars.com.

Re: Why emsi containers have @disabled this(this) ?

2020-05-19 Thread Mike Parker via Digitalmars-d-learn
On Tuesday, 19 May 2020 at 20:51:01 UTC, Luis wrote: So, I'm writing my own implementation of sparse sets, and I take as reference emsi_containers for allocator usage. I saw that they have disabled postblit operator... But i don't understand exactly why. In special, when they implement

Re: any chance to get it working on windows xp?

2020-05-17 Thread Mike Parker via Digitalmars-d-learn
On Sunday, 17 May 2020 at 22:30:22 UTC, a beginner wrote: I have searched online for some info, indeed I found something, but not being familiar with the tools it hasn't been terribly useful. Only it confirms that windows support is somewhat disappointing in general, xp or not. I've been

Re: XMM Intrinsics

2020-05-08 Thread Mike Parker via Digitalmars-d-learn
On Friday, 8 May 2020 at 20:14:05 UTC, Simen Kjærås wrote: The intel-intrinsics dub package aims to provide a compiler-independent layer: https://code.dlang.org/packages/intel-intrinsics TIL, thanks! :) -- Simen DConf 2019: Not intrinsically about intrinsics -- Guillaume Piolat

Re: Building Win32 application via dub

2020-04-29 Thread Mike Parker via Digitalmars-d-learn
On Wednesday, 29 April 2020 at 11:55:54 UTC, Sam E. wrote: I cannot find a D example using Win32 and the normal main function, and while it is working for simple message boxes, as soon as I want to do something slightly more complex (using a window), an hInstance has to be provided (as far

Re: Building Win32 application via dub

2020-04-29 Thread Mike Parker via Digitalmars-d-learn
On Wednesday, 29 April 2020 at 11:55:54 UTC, Sam E. wrote: On Wednesday, 29 April 2020 at 10:46:30 UTC, Mike Parker wrote: On Wednesday, 29 April 2020 at 10:44:48 UTC, Mike Parker wrote: Yeah, it says "WinMain is needed", which has never been true. THere's no need for the def file either.

Re: Building Win32 application via dub

2020-04-29 Thread Mike Parker via Digitalmars-d-learn
On Wednesday, 29 April 2020 at 10:44:48 UTC, Mike Parker wrote: On Wednesday, 29 April 2020 at 10:26:40 UTC, Sam E. wrote: I took the WinMain from https://wiki.dlang.org/D_for_Win32, should that documentation be updated to use a normal main function instead? Also the details regarding

Re: Building Win32 application via dub

2020-04-29 Thread Mike Parker via Digitalmars-d-learn
On Wednesday, 29 April 2020 at 10:27:35 UTC, Sam E. wrote: To be honest, I haven't yet found the way to switch between -m32 and -m64 (or other) via dub :) Pass the -a flag on the dub command line with the appropriate argument: For -m32: -ax86 For -m32mscoff: -ax86_mscoff For -m64:

Re: Building Win32 application via dub

2020-04-29 Thread Mike Parker via Digitalmars-d-learn
On Wednesday, 29 April 2020 at 10:26:40 UTC, Sam E. wrote: I took the WinMain from https://wiki.dlang.org/D_for_Win32, should that documentation be updated to use a normal main function instead? Also the details regarding linker flags may be a good addition to that wiki page. Yeah, it

Re: Building Win32 application via dub

2020-04-29 Thread Mike Parker via Digitalmars-d-learn
On Wednesday, 29 April 2020 at 09:43:53 UTC, Sam E. wrote: Though the program built with dub is now crashing at runtime when calling `writeln` within the `WinMain` block. The exception error is: Exception has occurred: W32/0xc096 Unhandled exception at 0x7FF643C5AFE4 in

Re: DConf 2017 Videos

2020-04-24 Thread Mike Parker via Digitalmars-d-learn
On Saturday, 25 April 2020 at 04:11:02 UTC, Ali Çehreli wrote: On 4/24/20 2:11 PM, Steven Schveighoffer wrote:> On 4/24/20 4:24 PM, matheus wrote: > whomever controlled the sociomantic youtube account took down > all the videos. I think it's unintentional because the same thing happened to

Re: DConf 2017 Videos

2020-04-24 Thread Mike Parker via Digitalmars-d-learn
On Friday, 24 April 2020 at 21:25:11 UTC, matheus wrote: On Friday, 24 April 2020 at 21:11:48 UTC, Steven Schveighoffer wrote: ... and whomever controlled the sociomantic youtube account took down all the videos... First of all thanks for replying and... Ouch! After that I hope D Foundation

Re: Github vs Bugzilla for submitting a PR/issue.

2020-04-13 Thread Mike Parker via Digitalmars-d-learn
On Monday, 13 April 2020 at 21:32:43 UTC, Adnan wrote: On Monday, 13 April 2020 at 21:31:49 UTC, Adnan wrote: I'm a bit confused about D's development process. I've seen people discussing DIPs in Github. I've also seen people discuss internal issues in bugzilla. How do these to correlate?

Re: Allocating an empty non null associative arary

2020-03-30 Thread Mike Parker via Digitalmars-d-learn
On Tuesday, 31 March 2020 at 02:51:11 UTC, Superstar64 wrote: I want to be modify an associative array by reference from another function. However null associative arrays are pass by value. How do I generically create an empty associative array? --- import std.stdio; void addElement(int[int]

Re: return val if

2020-03-22 Thread Mike Parker via Digitalmars-d-learn
On Sunday, 22 March 2020 at 19:04:40 UTC, Mike Parker wrote: ``` T returnValIfFail(T)(bool expr, T val) { if(expr) return val; else assert(0); } ``` Heh, of course, as Dennis pointed out, that's essentialy assert(expr). ``` assert(expr); x = val; ```

Re: return val if

2020-03-22 Thread Mike Parker via Digitalmars-d-learn
On Sunday, 22 March 2020 at 18:48:32 UTC, Abby wrote: Is there a way to create a template that would do the same is glib g_return_val_if_fail() (https://developer.gnome.org/glib/stable/glib-Warnings-and-Assertions.html#g-return-val-if-fail) I was hoping something like this would work

Re: Why are class variables public, when marked by the 'private' keyword?

2020-03-20 Thread Mike Parker via Digitalmars-d-learn
On Saturday, 21 March 2020 at 04:45:29 UTC, Kirill wrote: I was playing around with visibility attributes in D. I created a class with private variables. Then I tried to access those variables through the class object. It compiled without any errors. However, ... Shouldn't the compiler

Re: Best way to learn 2d games with D?

2020-03-16 Thread Mike Parker via Digitalmars-d-learn
On Monday, 16 March 2020 at 16:19:26 UTC, Arine wrote: There's no need for someone learning 2D games to even bother with SDL2 to begin with. If you use SDL2 you are going to be using something no one else uses, you'll be wasting your by using something that isn't that good and what you learn

Re: Best way to learn 2d games with D?

2020-03-16 Thread Mike Parker via Digitalmars-d-learn
On Monday, 16 March 2020 at 05:45:52 UTC, bauss wrote: Please don't recommend Derelict to anyone :-) bindbc-sdl is what folks should be using now. I'm not maintaining Derelict anymore. Haven't even heard of that! Does it work in similar fashion? Yes. The loader is @nog and betterC

Re: Best way to learn 2d games with D?

2020-03-15 Thread Mike Parker via Digitalmars-d-learn
On Sunday, 15 March 2020 at 21:33:29 UTC, Arine wrote: I wouldn't use SDL2 for rendering. It is really just there for legacy. The only thing people use SDL2 is for setting up a window and creating a render context for OpenGL/Vulkan/Directx, along with handling input/events. There's no

Re: Best way to learn 2d games with D?

2020-03-15 Thread Mike Parker via Digitalmars-d-learn
On Sunday, 15 March 2020 at 18:14:44 UTC, bauss wrote: I would recommend using Derelict and SDL with D since it's the most mature. Please don't recommend Derelict to anyone :-) bindbc-sdl is what folks should be using now. I'm not maintaining Derelict anymore.

<    1   2   3   4   5   6   7   8   9   10   >