Re: Deriving a struct from another one via template: Easy way to propagate UDAs?

2024-03-17 Thread Adam D Ruppe via Digitalmars-d-learn
On Saturday, 16 March 2024 at 20:34:57 UTC, Inkrementator wrote: Nice. Btw I vaguely remember you also wrote about how and why to reduce the usage string mixins, with some real example of alternative techniques you used go to the main page: http://dpldocs.info/this-week-in-d/Blog.html and

Re: Deriving a struct from another one via template: Easy way to propagate UDAs?

2024-03-16 Thread Adam D Ruppe via Digitalmars-d-learn
On Thursday, 14 March 2024 at 23:19:37 UTC, Inkrementator wrote: * Is UDA propagation possible without string mixins? @(__traits(getAttributes, thingYouWantToForward)) void yourNewThing() {} * Are template mixins vulnerable to name collisions?

Re: Non-blocking keyboard input

2023-12-27 Thread Adam D Ruppe via Digitalmars-d-learn
On Wednesday, 27 December 2023 at 05:07:04 UTC, Joe wrote: ??? Surely there there is a one liner library solution for this? It is not one line because it needs a bit of setup (and teardown, but the objects' destructors do that for you) but it is close:

Re: Browsers in D

2023-12-21 Thread Adam D Ruppe via Digitalmars-d-announce
On Thursday, 21 December 2023 at 11:55:50 UTC, aberba wrote: I have this idea of building a web view based desktop app with a webserver and db backend for CRUD functionality. This looks like a great option. Yeah, it is a solid choice with a long history. Did you know the Unix Printing System

Re: Browsers in D

2023-12-20 Thread Adam D Ruppe via Digitalmars-d-announce
On Wednesday, 20 December 2023 at 09:29:36 UTC, Paolo Invernizzi wrote: When I was the CTO of my previous company, we embedded Gecko into a custom C++ GUI framework, to allow ALS people browse the web using gazes as an input method: it was a real pain ... Wow, yeah, I know it must be

Re: Browsers in D

2023-12-20 Thread Adam D Ruppe via Digitalmars-d-announce
On Wednesday, 20 December 2023 at 06:29:30 UTC, Hors wrote: Rust is better choice than D if you have to run code from untrusted resources (html, javascript, webassembly...) it's safer, plus faster. That's not how it actually works in any of the browsers though. The code that implements those

Re: Browsers in D

2023-12-19 Thread Adam D Ruppe via Digitalmars-d-announce
On Tuesday, 19 December 2023 at 23:40:48 UTC, Antonio wrote: It was not the first neither the last problem that a new version of chrome caused to our company Oh, I'm old enough to remember the Chrome auto-update that broke standard HTML links! It was such a pain supporting it in the first

Re: SIGSEGV (Segmentation Fault) upon setting character in char array (object member var)

2023-12-19 Thread Adam D Ruppe via Digitalmars-d-learn
On Tuesday, 19 December 2023 at 13:10:40 UTC, John Kiro wrote: class Test { static enum MAX = 10; uint index = 0; auto intArray = new int[MAX]; auto charArray = new char[MAX]; This is run at compile time, and the compiler treats any char array at compile time

Re: Operator "+=" overloading for class?

2023-12-16 Thread Adam D. Ruppe via Digitalmars-d-learn
On Sunday, 17 December 2023 at 04:13:20 UTC, Ki Rill wrote: auto opOpAssign(string op)(in ElementType rhs) { mixin("return this" ~ op ~ "rhs;"); } ``` check what `op` is. pretty sure it is "+" not "+=" so your element isnt' saved anywhere. also a bit iffy there isn't a member here to

Re: Is it possible to set/override the name of the source file when piping it into DMD via stdin?

2023-12-13 Thread Adam D Ruppe via Digitalmars-d-learn
On Wednesday, 13 December 2023 at 19:37:09 UTC, Siarhei Siamashka wrote: Now I'm curious. Is it possible to somehow communicate the real source file name to `dmd`, so that it shows up in the error log instead of "__stdin.d"? the sequence `#line "filename.d" 1` at the top of the thing might

Re: question

2023-12-13 Thread Adam D Ruppe via Digitalmars-d-learn
On Wednesday, 13 December 2023 at 12:49:14 UTC, fred wrote: a bug ? It helps if you explain what you're talking about so we don't have to guess. I tried the code on my computer and it worked fine. But then figuring, you must be saying something doesn't work right, I tried it on another

Re: union default initialization values

2023-12-05 Thread Adam D Ruppe via Digitalmars-d-learn
On Tuesday, 5 December 2023 at 19:24:51 UTC, confuzzled wrote: Given the following union union F { double x; struct { ulong lo; ulong hi; } } The default value of this would be `double.init`, since the first member of the union is a `double`, which is a kind of

Re: struct initializer

2023-12-01 Thread Adam D Ruppe via Digitalmars-d-learn
On Friday, 1 December 2023 at 13:02:06 UTC, Dom DiSc wrote: Either allow it for all initializations, or get rid of it, like DIP 1031 suggested. I thought the decision actually was made to just get rid of it.

Re: 'typeof' question

2023-11-28 Thread Adam D Ruppe via Digitalmars-d-learn
On Tuesday, 28 November 2023 at 18:41:49 UTC, DLearner wrote: A* A_Ptr; struct B { int BFld2; typeof(A_Ptr)[0..($-1)] ASUB; // Idea is ASUB of type A, from A_Ptr of type A*. I think what you really want is typeof(*A_Ptr) ASUB; the typeof thing returns the type you'd get from the

Re: Why this compiles?

2023-11-26 Thread Adam D Ruppe via Digitalmars-d-learn
On Sunday, 26 November 2023 at 21:45:21 UTC, Antonio wrote: In this example, ```a``` and ```b``` vars are not of the same type and don't implement the same interface. **why ```assert(a==b)``` compiles?** They're both subclasses of Object and inherit a generic opEquals from that base.

Re: mixin under -betterC

2023-11-26 Thread Adam D Ruppe via Digitalmars-d-learn
On Thursday, 23 November 2023 at 16:33:52 UTC, DLearner wrote: string mxnTest(string strVar1, string strVar2) { return `(int Var1, int Var2) { if (Var1 > Var2) { return true; } else { return false; } }(` ~ strVar1 ~ `,` ~ strVar2 ~ `)`; } ``` This

Re: DLF September 2023 Planning Update

2023-11-22 Thread Adam D Ruppe via Digitalmars-d-announce
On Tuesday, 21 November 2023 at 13:13:06 UTC, Guillaume Piolat wrote: I'd argue people come to languages because of arguably alive libraries, and dead libraries less so. Yeah, I think this is solving the wrong problem, but even if we decide to do it anyway it is very important not to hurt

Re: DLF September 2023 Planning Update

2023-11-14 Thread Adam D Ruppe via Digitalmars-d-announce
On Wednesday, 15 November 2023 at 02:27:42 UTC, Mike Shah wrote: I just want to echo Steve's sentiment, that it should be easy for new (and old) D users to start up a project without worrying about editions. Actually, this brings another question to mind: what about old users who keep up

Re: under gdb: received signal SIG34, Real-time event 34.; received signal SIG35, Real-time event 35

2023-11-14 Thread Adam D Ruppe via Digitalmars-d-learn
On Tuesday, 14 November 2023 at 21:31:39 UTC, mw wrote: handle SIGUSR1 noprint handle SIGUSR2 noprint These are what the GC used to use to stop/start threads. received signal SIG34, Real-time event 34. received signal SIG35, Real-time event 35. And this is what it uses now. druntime just

Re: DLF September 2023 Planning Update

2023-11-14 Thread Adam D Ruppe via Digitalmars-d-announce
On Tuesday, 14 November 2023 at 17:57:36 UTC, Steven Schveighoffer wrote: That's not any better. If you have to opt-in to the language as it exists, people are going to quit immediately. Counterpoint: javascript's "use strict". On the gripping hand though, I basically never use that and most

Re: D: How do I pipe (|) through three programs using std.process?

2023-11-12 Thread Adam D Ruppe via Digitalmars-d-learn
On Sunday, 12 November 2023 at 13:39:25 UTC, BoQsc wrote: However the question of why `spawnProcess(["find", "string to find"]` is not working and produces error is still unresolved. spawnProcess always encodes its arguments in a very specific way and the receiving programs are not always

Re: why remove octal literal support?

2023-11-03 Thread Adam D Ruppe via Digitalmars-d-learn
On Friday, 3 November 2023 at 15:07:41 UTC, d007 wrote: dlang is know for compile speed, but in reality d project compile slow because so much ctfe and tempalte. Some ctfe and templates are slow. Usually larger functions or array/string append loops end up being to blame. Octal literals

Re: Keyword "package" prevents from importing a package module "package.d"

2023-11-03 Thread Adam D Ruppe via Digitalmars-d-learn
On Friday, 3 November 2023 at 00:19:48 UTC, Andrey Zherikov wrote: Is there any guide how one can refactor single-module package into multi-module package with distinction between public and private modules? Call the modules literally anything else and it works better. So say you have module

Re: Keyword "package" prevents from importing a package module "package.d"

2023-11-02 Thread Adam D Ruppe via Digitalmars-d-learn
On Thursday, 2 November 2023 at 19:30:58 UTC, Jonathan M Davis wrote: The entire reason that it was added to the language was to be able to split up existing modules without breaking code. And it does that well. No, it doesn't do that well at all. In fact, it does that so extremely poorly

Re: Keyword "package" prevents from importing a package module "package.d"

2023-11-02 Thread Adam D Ruppe via Digitalmars-d-learn
On Thursday, 2 November 2023 at 12:52:35 UTC, BoQsc wrote: Therefore the need to import `package.d` is needed and I can't see a solution, which means tbh package.d should never be used. It is a poorly designed, buggy misfeature of the language with plenty of better working alternatives (it

Re: GUI text input dialog with few lines

2023-10-28 Thread Adam D Ruppe via Digitalmars-d-dwt
On Monday, 23 October 2023 at 16:50:08 UTC, Felipe Lema wrote: Hey, I know this is stretching it out, but ... how can I do "Ctrl-v" to paste the clipboard content? Ah, sorry, I missed this - I don't follow this forum daily (it was pure coincidence your first message came in when I happened

Re: GUI text input dialog with few lines

2023-10-20 Thread Adam D Ruppe via Digitalmars-d-dwt
On Friday, 20 October 2023 at 20:43:21 UTC, Felipe Lema wrote: I don't mind using any or other GUI framework, but I do aim to have a windows-exe-with-as-few-dlls-as-possible My minigui.d can do this fairly easily: ``` import arsd.minigui; void main() { // need to define the data you

Re: use dmd for bare metal i386

2023-10-13 Thread Adam D Ruppe via Digitalmars-d-learn
On Friday, 13 October 2023 at 22:14:36 UTC, Dmitry Ponyatov wrote: Is dmd able to be forced not include some unneeded information into target object files to make bare metal 32-bit code? Need some samples and build scripts to do it. Make an empty file called object.d in your build directory

Re: Straight Forward Arrays

2023-10-01 Thread Adam D Ruppe via Digitalmars-d-learn
On Sunday, 1 October 2023 at 09:01:53 UTC, dhs wrote: When D creates a dynamic array, it returns a slice. Functions that add or remove elements begin by asking the memory manager for the dynamic array that the slice belongs to. Only then can they go on and add elements. Why is this a

Re: reggae v0.10.0 - The meta build system just got better

2023-09-17 Thread Adam D Ruppe via Digitalmars-d-announce
On Friday, 15 September 2023 at 20:22:50 UTC, Atila Neves wrote: An argument could be made that it could/should install the dependencies such that only one `-I` flag is needed. Indeed, this would be god tier. ~190k SLOC (not counting the many dub dependencies) killed dmd on a system with

Re: reggae v0.10.0 - The meta build system just got better

2023-09-12 Thread Adam D Ruppe via Digitalmars-d-announce
On Tuesday, 12 September 2023 at 13:12:29 UTC, Atila Neves wrote: It does mean adding `-I` flags to every dependency though, so there's that. Not if you install them properly. And for larger codebases `dmd -i` can't and won't work. Define "larger".

Re: reggae v0.10.0 - The meta build system just got better

2023-09-11 Thread Adam D Ruppe via Digitalmars-d-announce
I tried reggae today. It did not go well. http://dpldocs.info/this-week-in-d/Blog.Posted_2023_09_11.html#reggae-editorial

Re: Is this a ctfe bugs ? ref scope const(ubyte)[32]

2023-09-06 Thread Adam D Ruppe via Digitalmars-d-learn
On Wednesday, 6 September 2023 at 12:04:40 UTC, d007 wrote: extern(C) int test(ref scope const(ubyte)[32] b); extern(C) int test(ref scope const(ubyte[32]) b); These are the same thing since the ref cannot be rebound anyway; a static array just is its contents.

Re: parallel threads stalls until all thread batches are finished.

2023-08-25 Thread Adam D Ruppe via Digitalmars-d-learn
On Wednesday, 23 August 2023 at 13:03:36 UTC, Joe wrote: to download files from the internet. Are they particularly big files? You might consider using one of the other libs that does it all in one thread. (i ask about size cuz mine ive never tested doing big files at once, i usually use it

Re: D Language Foundation August 2023 Monthly Meeting Summary

2023-08-22 Thread Adam D Ruppe via Digitalmars-d-announce
On Tuesday, 22 August 2023 at 21:36:49 UTC, An Pham wrote: 1. DMD does not have consistent way of defining system attribute which can cause conflict with user attribute (DMD system attribute should start with underscore character, "_") Not true, these attributes follow module namespacing

Re: How to create an .exe without execute the terminal in Windows?

2023-08-12 Thread Adam D Ruppe via Digitalmars-d-learn
On Saturday, 12 August 2023 at 23:13:39 UTC, thePengüin wrote: I would know how to make some this but in Dlang: best way is to use the linker switch. On Win32, you can pass -L/subsystem:windows if you don't want a console to be automatically allocated. Please note when compiling on

Re: pragma lib doesn't support static libraries?

2023-07-30 Thread Adam D Ruppe via Digitalmars-d-learn
On Sunday, 30 July 2023 at 05:53:55 UTC, Mike Parker wrote: And I'm unaware of any mechanism for embedding static library names in an object file for a linker to read later. There is a mechanism on Windows, so it tends to work there, but yeah no luck on the other platforms.

Re: Unicode in strings

2023-07-27 Thread Adam D Ruppe via Digitalmars-d-learn
On Thursday, 27 July 2023 at 22:15:47 UTC, Cecil Ward wrote: How do I get a wstring or dstring with a code point of 0xA0 in it ? note that you don't need wstring and dstring to express all unicode strings.

Re: array index out of bound may not throw exception?

2023-07-21 Thread Adam D Ruppe via Digitalmars-d-learn
On Friday, 21 July 2023 at 21:27:45 UTC, mw wrote: However, I just debugged a case, where out of bound array index didn't throw exception, and just hang the thread Uncaught exceptions in a thread terminate that thread and are reported when you call the `join` method of the thread. I think

Re: Redirecting standard streams in Windows

2023-07-18 Thread Adam D Ruppe via Digitalmars-d-learn
On Tuesday, 18 July 2023 at 23:52:06 UTC, Alexander Zhirov wrote: PS C:\dlang\test> cat .\stderr.txt How does the cat program know what the encoding of the file is? Try opening it in notepad or something and specifying the encoding. I betcha it is perfectly fine.

Re: Redirecting standard streams in Windows

2023-07-18 Thread Adam D Ruppe via Digitalmars-d-learn
On Tuesday, 18 July 2023 at 21:31:54 UTC, Alexander Zhirov wrote: HANDLE h_stdout = GetStdHandle(STD_OUTPUT_HANDLE); WriteConsoleW(h_stderr, str.ptr, cast(DWORD)str.length, NULL, NULL); If you checked the return value of this call, you'd find it fails since WriteConsole only works

Re: Inlined functions and their original bodies - bloat

2023-07-09 Thread Adam D Ruppe via Digitalmars-d-learn
On Sunday, 9 July 2023 at 18:05:48 UTC, Cecil Ward wrote: This is with full -O3 optimisation try -fvisibility=hidden -release sux btw

Re: Reading an environment variable value

2023-06-29 Thread Adam D Ruppe via Digitalmars-d-learn
On Thursday, 29 June 2023 at 18:47:48 UTC, Josh Holtrop wrote: $ ldc2 -of environment environment.d Since you named the file `environment.d` and didn't use an explicit `module name.thing;` declaration, the compiler assumes it should match the filename. So it injects an implicit `module

Re: pragma msg field name?

2023-06-27 Thread Adam D Ruppe via Digitalmars-d-learn
On Tuesday, 27 June 2023 at 22:20:22 UTC, Chris Katko wrote: pragma(msg, t.stringof); // does not see any new fields! D's declarations are all order-independent, in theory those foreaches are done simultaneously, so it is kinda a race condition. In practice, the compiler

Re: pragma msg field name?

2023-06-27 Thread Adam D Ruppe via Digitalmars-d-learn
On Tuesday, 27 June 2023 at 04:25:13 UTC, Chris Katko wrote: How do I get just the field name? __traits(identifier, field) And why does it think this is a run-time value? It is the same as if you wrote `Class.field`

Re: Beerconf June 2023

2023-06-24 Thread Adam D Ruppe via Digitalmars-d-announce
On Saturday, 24 June 2023 at 22:52:01 UTC, Chris Katko wrote: Will there be a YouTube/whatever mirror of the conference afterward? most the weekend is just a handful of random people coming and going at random times and talking about random stuff more of just like a online hang out than

Re: Mixin and compile-time functions for code generation

2023-06-24 Thread Adam D Ruppe via Digitalmars-d-learn
On Saturday, 24 June 2023 at 17:31:31 UTC, Cecil Ward wrote: Can I get mixin whatever to do this for me? Mixin with a function that runs at compile-time and creates the required source ? have you tried it?

Re: Union with bits ?

2023-06-14 Thread Adam D Ruppe via Digitalmars-d-learn
On Wednesday, 14 June 2023 at 08:51:19 UTC, Rene Zwanenburg wrote: You can do something like this if you don't mind compiling with -preview=bitfields: That doesn't do what you think it does. There's no guarantee the bits will actually line up with the status byte. The best way to do what

Re: How get struct value by member name string ?

2023-05-29 Thread Adam D Ruppe via Digitalmars-d-learn
On Monday, 29 May 2023 at 09:35:11 UTC, John Xu wrote: Error: variable `column` cannot be read at compile time you should generally getMember on a variable T t; __traits(getMember, t, "name") like that, that's as if you wrote t.name

Re: Complicated @property access only works when I write an extra parenthesis "()"

2023-05-26 Thread Adam D Ruppe via Digitalmars-d-learn
On Friday, 26 May 2023 at 21:00:20 UTC, realhet wrote: Only the extra () let it compile successfuly. No way to fix it. If the function takes an extra argument you can kinda trick it but for zero arg function pointer return from a property it is just plain broken and has been the whole time.

Re: Given an object, how to call an alias to a member function on it?

2023-05-03 Thread Adam D Ruppe via Digitalmars-d-learn
On Tuesday, 2 May 2023 at 13:57:23 UTC, Steven Schveighoffer wrote: Isn't that what `__traits(child)` is for? https://dlang.org/spec/traits.html#child Yes, __traits(child, object, method_alias)(args) is the way to do it.

Re: std.socket tutorials? examples?

2023-04-30 Thread Adam D Ruppe via Digitalmars-d-learn
On Sunday, 30 April 2023 at 22:10:31 UTC, Cecil Ward wrote: How do we wait for an ‘or’ of multiple asynchronous events in this kind of code? You can set a timeout value for Socket.select, but Phobos isn't going to help you with anything other than sockets and timeouts (despite the fact the

Re: A Programmer's Dilema: juggling with C, BetterC, D, Macros and Cross Compiling, etc.

2023-04-30 Thread Adam D Ruppe via Digitalmars-d-learn
On Sunday, 30 April 2023 at 17:51:15 UTC, Eric P626 wrote: * Use D for everything, no C compatibility. This is a false dilemma: D has full C compatibility.

Re: std.socket tutorials? examples?

2023-04-29 Thread Adam D Ruppe via Digitalmars-d-learn
On Saturday, 29 April 2023 at 10:56:46 UTC, Jan Allersma wrote: auto clientResult = Socket.select(clientSet, null, null); There's probably nothing in clientSet, so it is waiting for nothing you almost always want to have just one call to select in the program, not two, the whole point

Re: arsd 11 progress report - scheduled for release in May

2023-04-21 Thread Adam D Ruppe via Digitalmars-d-announce
On Friday, 21 April 2023 at 02:34:10 UTC, Chris Piker wrote: A cursory reading of the cgi module indicates that arsd provide some of the same functionality of vibe.d, but uses multi-processes or multi-threads instead of fibers. Is that true? It actually does a lot more than that, including

Re: DlangUI Layout Justification

2023-04-07 Thread Adam D Ruppe via Digitalmars-d-learn
On Friday, 7 April 2023 at 15:52:02 UTC, Ali Çehreli wrote: I don't know how relevant it is but there is also Hipreme Engine that supports Android: I think the question is if you are doing games vs doing other applications. There's some overlap between game and gui, but not actually that

Re: Why are globals set to tls by default? and why is fast code ugly by default?

2023-04-01 Thread Adam D Ruppe via Digitalmars-d-learn
On Saturday, 1 April 2023 at 13:11:46 UTC, Guillaume Piolat wrote: TLS could be explicit and we wouldn't need a -vtls flag. Yeah, I think what we should do is make each thing be explicitly marked. When I want tls, I tend to comment that it was intentional anyway to make it clear I didn't

arsd 11 progress report - scheduled for release in May

2023-03-21 Thread Adam D Ruppe via Digitalmars-d-announce
I haven't written much in the blog lately but I tried to catch up a little this week with a progress report of the code I intend to release in a couple more months. http://dpldocs.info/this-week-in-d/Blog.Posted_2023_03_20.html

Re: Read a text file at once for regex searching

2023-03-20 Thread Adam D Ruppe via Digitalmars-d-learn
On Monday, 20 March 2023 at 17:42:17 UTC, Paul wrote: Do we have some such function in our std library? Try static import std.file; string s = std.file.readText("filename.txt"); http://phobos.dpldocs.info/std.file.readText.html

Re: Code organization, dub, etc.

2023-03-13 Thread Adam D Ruppe via Digitalmars-d-learn
On Monday, 13 March 2023 at 13:20:21 UTC, Joe wrote: Yeah, it seems like it's *only* for libraries (and a few single-exe utilities). Looking at code.dlang.org, under "Stand-alone applications/Server software", the top rated item is "handy-httpd" which according to its dub.json builds a

Re: 'auto' keyword

2023-03-12 Thread Adam D Ruppe via Digitalmars-d-learn
On Sunday, 12 March 2023 at 13:07:58 UTC, DLearner wrote: Is it correct that this _single_ keyword is used to indicate _two_ quite different things: No, it only actually does #2 in your thing. The type is optional meaning *any* storage class will work for type inference. `auto` is not

Re: Desiring bool any_key_pressed()

2023-03-04 Thread Adam D Ruppe via Digitalmars-d-learn
On Friday, 3 March 2023 at 03:38:56 UTC, Daren Scot Wilson wrote: Here is a very simple version of the program I'm working on. Is there a way to write is_any_key_pressed() that doesn't block, doesn't require the Enter key, and doesn't require dragging in any complex libraries or dealing with

Re: Can't load FreeImage.dll with Windows

2023-03-03 Thread Adam D Ruppe via Digitalmars-d-learn
On Friday, 3 March 2023 at 19:07:14 UTC, WhatMeWorry wrote: loadFreeImage(`c:\Users\Admin\Downloads\FreeImage3180Win32Win64\FreeImage\Dist\x64\FreeImage.dll`); is your application build 64 bit too?

Re: D Language Foundation January 2023 Quarterly Meeting Summary

2023-03-01 Thread Adam D Ruppe via Digitalmars-d-announce
On Wednesday, 1 March 2023 at 13:01:03 UTC, Guillaume Piolat wrote: I think this has been the direction for years: ProtoObject, Object.factory, etc. These things don't really help with it unfortunately, but yes, this is the best goal.

Re: D Language Foundation January 2023 Quarterly Meeting Summary

2023-02-27 Thread Adam D Ruppe via Digitalmars-d-announce
On Monday, 27 February 2023 at 14:18:04 UTC, M.M. wrote: In the recent post by Mike Parker, betterC is used as a great alternative to C for writing bare-metal RISC-V application: Real D can do this too. betterC needs to die, it is just arbitrary special cases that add tech debt to the

Re: D Language Foundation January 2023 Quarterly Meeting Summary

2023-02-27 Thread Adam D Ruppe via Digitalmars-d-announce
On Monday, 27 February 2023 at 12:08:58 UTC, newbie wrote: with `betterC` you can target into new platform without much work, and easy to deal with dynamic library, generate much fast and smaller binary. you can do this without betterC too. often easier. And it could be even easier with a

Re: How to get only the field name from an alias?

2023-02-21 Thread Adam D Ruppe via Digitalmars-d-learn
On Tuesday, 21 February 2023 at 02:41:34 UTC, Elfstone wrote: apparently F.stringof You almost never want to use .stringof, instead try __traits(identifier, F) and see what it gives you. Alternatively, loop over __traits(allMembers) which gives you the member names and pass that down. You

Re: Non-ugly ways to implement a 'static' class or namespace?

2023-02-18 Thread Adam D Ruppe via Digitalmars-d-learn
On Saturday, 18 February 2023 at 21:23:24 UTC, ProtectAndHide wrote: The more I look at D, the more I like C++. cya

Re: Want a module to import from a sister directork; How?

2023-02-14 Thread Adam D Ruppe via Digitalmars-d-learn
On Tuesday, 14 February 2023 at 21:23:26 UTC, ryuukk_ wrote: module name must correspond to its path this is not true.

Re: Non-ugly ways to implement a 'static' class or namespace?

2023-02-09 Thread Adam D Ruppe via Digitalmars-d-learn
On Thursday, 9 February 2023 at 13:00:04 UTC, thebluepandabear wrote: For my school I am commissioned to create many types of software. I tried to have a look at some of the gui kits in D but there was no tutorial for how to use them and they seemed as if they are lacking features in

Re: Non-ugly ways to implement a 'static' class or namespace?

2023-02-09 Thread Adam D Ruppe via Digitalmars-d-learn
On Thursday, 9 February 2023 at 12:31:03 UTC, thebluepandabear wrote: I am actually taking a computer science class and I need to create desktop apps to pass and get through school. This is pretty easy in D. Like what specific kind of desktop app?

Re: betterC DLL in Windows

2023-02-04 Thread Adam D Ruppe via Digitalmars-d-learn
On Saturday, 4 February 2023 at 18:40:51 UTC, Tamas wrote: I do take your word for it, but now I have to re-evaluate my expectations towards D and perhaps use it for another project. I've got most of my project working in C already, but I was hoping to add some safety and better

Re: betterC DLL in Windows

2023-02-04 Thread Adam D Ruppe via Digitalmars-d-learn
On Saturday, 4 February 2023 at 19:49:41 UTC, bachmeier wrote: I'm not sure what Adam's getting at when he says "hopelessly broken" but it's basically a subset of D. You're almost guaranteed to hit some wall with it and have no solution. Some of these are bugs but some of them are by design;

Re: betterC DLL in Windows

2023-02-04 Thread Adam D Ruppe via Digitalmars-d-learn
On Saturday, 4 February 2023 at 18:11:05 UTC, Tamas wrote: Well, as I'm new to D this isn't something I have insight into. Then you'd probably be better off taking my word for it (or even trusting your own limited experience where things worked until you added the switch) and just not using

Re: betterC DLL in Windows

2023-02-04 Thread Adam D Ruppe via Digitalmars-d-learn
On Saturday, 4 February 2023 at 16:45:31 UTC, Tamas wrote: and they compile without `-betterC`, but fail with link errors when using the switch. then don't use the switch lol -betterC is barely supported and completely useless so better to just not use it. export extern (C) void main()

Re: WildCAD - a simple 2D drawing application

2023-02-03 Thread Adam D Ruppe via Digitalmars-d-announce
On Friday, 3 February 2023 at 08:30:55 UTC, Johann Lermer wrote: That at least should be fixed now. Confirmed, works here now! BTW I did `time make -j6` this time and it said 10 seconds, so still think the dmd -i approach better but if your incremental builds are smaller it might be better,

Re: Which TOML package, or SDLang?

2023-01-30 Thread Adam D Ruppe via Digitalmars-d-learn
On Monday, 30 January 2023 at 15:37:56 UTC, Guillaume Piolat wrote: Why not XML? :) It has comments, you can use backslashes too. no kidding, xml is an underrated format.

Re: WildCAD - a simple 2D drawing application

2023-01-30 Thread Adam D Ruppe via Digitalmars-d-announce
On Monday, 30 January 2023 at 13:51:14 UTC, Johann Lermer wrote: Where exactly does this happen to you and what window manager do you use? I use old Blackbox. But it happens always, you click the window and it pops up as if the window is at (0, 0) instead of where it actually is. Probably

Re: WildCAD - a simple 2D drawing application

2023-01-29 Thread Adam D Ruppe via Digitalmars-d-announce
On Sunday, 29 January 2023 at 17:14:40 UTC, Johann Lermer wrote: right - but isn't one of make's features, that it compiles code only when the source changes? When you just compile the whole thing at once, I would expect that you get longer times than when you change just one source file and

Re: WildCAD - a simple 2D drawing application

2023-01-29 Thread Adam D Ruppe via Digitalmars-d-announce
On Sunday, 29 January 2023 at 13:55:41 UTC, Richard (Rikki) Andrew Cattermole wrote: dub isn't the issue, people who fight it like this, fight the D compilers and end up having issues. dub fights D compilers. This is why it forces me to write 600 lines of ugly configuration file for something

Re: WildCAD - a simple 2D drawing application

2023-01-26 Thread Adam D Ruppe via Digitalmars-d-announce
I briefly played around with it, not bad at all. I did see the menus popped up in the wrong place though, something to note is that ConfigureNotify is a bit complicated in how it works. Let me copy/paste a comment from my simpledisplay.d: /+ The ICCCM says window managers must send a

Re: Qonquest 2 - A simple strategy game written in D

2023-01-25 Thread Adam D Ruppe via Digitalmars-d-announce
It is my fault for resizing, i used width,height instead of width_,height_ so it used the pre-scaled things. https://github.com/adamdruppe/arsd/commit/0019a7c6fb18453125b75aec465be7e5dce6f598 I think this also broke the mouse thing since it didn't adjust for the title bar indeed and then the

Re: Qonquest 2 - A simple strategy game written in D

2023-01-25 Thread Adam D Ruppe via Digitalmars-d-announce
On Thursday, 26 January 2023 at 00:16:09 UTC, Hipreme wrote: The only button that works is the one that makes you lose. The function that dispatches click events to the in-game windows has a bug in its y coordinate. Click about a title bar width below a button and it will trigger. I

Re: D Language Foundation Monthly Meeting Summary for December 2022

2023-01-23 Thread Adam D Ruppe via Digitalmars-d-announce
On Monday, 23 January 2023 at 20:06:46 UTC, H. S. Teoh wrote: There should be a tool for auto-generating JS wrappers, perhaps even HTML snippets, so that a user literally can just write: import std; // OK, maybe import std.wasm or something void main() { writeln("Hello,

Re: Non-ugly ways to implement a 'static' class or namespace?

2023-01-22 Thread Adam D Ruppe via Digitalmars-d-learn
On Monday, 23 January 2023 at 00:21:12 UTC, thebluepandabear wrote: there's nothing in the language currently that would 'force' the user Why do you hate freedom?

Re: How to write a library

2023-01-21 Thread Adam D Ruppe via Digitalmars-d-learn
On Saturday, 21 January 2023 at 22:53:19 UTC, Matt wrote: but what is the D equivalent to header files, and what do I have to do to prepare and use my library in another project? The most common and easiest thing in D is to just distribute the source files, the compiler can pull whatever it

Re: D Language Foundation Monthly Meeting Summary for December 2022

2023-01-21 Thread Adam D Ruppe via Digitalmars-d-announce
On Saturday, 21 January 2023 at 04:29:28 UTC, Mike Parker wrote: As far as he understood, the only time `@property` has an effect is when you take the address of a function it annotates. It is when you do typeof(thing.prop), not Walter said that `__traits` is meant to be ugly. We should

Re: Is there a way to get a template’s parameters and constraints?

2023-01-20 Thread Adam D Ruppe via Digitalmars-d-learn
On Friday, 20 January 2023 at 17:15:31 UTC, Quirin Schroll wrote: Is there a trait (or a combination of traits) that gives me the constraints of a template? No, reflection over templates is very limited.

Re: D Static Array

2023-01-15 Thread Adam D Ruppe via Digitalmars-d-learn
On Sunday, 15 January 2023 at 14:23:59 UTC, Salih Dincer wrote:    int[0] arr = 40; // ? The = 40 means fill all array entries with the number 40. The [0] means there are no array elements. So it filled all the 0 elements with the number 40. If it was like int[3] arr = 40, then arr[0],

Re: Mixin helper help

2023-01-14 Thread Adam D Ruppe via Digitalmars-d-learn
On Saturday, 14 January 2023 at 18:57:21 UTC, John Chapman wrote: I wanted to remove the double braces in my static foreach (needed as I declared some aliases inside but since it creates a scope those new variables can't be referred to outside of it). Inside a function, you can often just use

Re: Failed to archive JPEG (ArchiveMember): Invalid UTF-8 sequence (at index 1)

2023-01-13 Thread Adam D Ruppe via Digitalmars-d-learn
On Saturday, 14 January 2023 at 01:08:25 UTC, Ki Rill wrote: a JPEG image. member.expandedData(file.readText().dup().representation()); A jpeg image is not a text file. Read it with `std.file.read()` instead of `readText`. Then you can get rid of those useless dup.representation calls

Re: D Language Foundation Monthly Meeting Summary for November 2022

2023-01-12 Thread Adam D Ruppe via Digitalmars-d-announce
On Thursday, 12 January 2023 at 11:47:26 UTC, Mike Parker wrote: Andrei asked Razvan about the status of [the ProtoObject DIP](https://github.com/dlang/DIPs/blob/master/DIPs/other/DIP1042.md). Razvan said that Adam Ruppe had raised some valid complaints in the DIP's pull request thread, and

Re: enum functions

2023-01-10 Thread Adam D Ruppe via Digitalmars-d-learn
On Sunday, 8 January 2023 at 18:42:58 UTC, Salih Dincer wrote: I'm wondering 2 things; firstly, does having an enum mean there is no auto-return? Or could it be CTFE? It means nothing. The keyword tells the parser a function is about to begin, which triggers return type inference (exactly the

Re: Good News: Almost all druntime supported on arsd webassembly

2023-01-06 Thread Adam D Ruppe via Digitalmars-d-announce
On Friday, 6 January 2023 at 22:14:23 UTC, Ferhat Kurtulmuş wrote: One question. Does GC work with Adam's druntime for wasm? I haven't actually written one yet, so it leaks if you don't pay attention yourself. But I have a plan that should work: you do the setTimeout(collect, 0) so it runs

Re: Good News: Almost all druntime supported on arsd webassembly

2023-01-06 Thread Adam D Ruppe via Digitalmars-d-announce
On Friday, 6 January 2023 at 22:13:15 UTC, H. S. Teoh wrote: The big question I have right now is, what's the status of interfacing with web APIs such as WebGL? This part is really easy, you can call it from D with the opDispatch or pass it through as eval strings.

Re: Error "Outer Function Context is Needed" when class declared in unittest

2023-01-05 Thread Adam D Ruppe via Digitalmars-d-learn
On Thursday, 5 January 2023 at 16:38:49 UTC, Vijay Nayar wrote: Does that class inherit the scope of the function it is inside, similar to how an inner class does with an outer class? yup. They can see the local variables from the function.

Re: Error "Outer Function Context is Needed" when class declared in unittest

2023-01-05 Thread Adam D Ruppe via Digitalmars-d-learn
On Thursday, 5 January 2023 at 13:27:23 UTC, Vijay Nayar wrote: Why is this error only found when declaring a class in the unittest? A unittest is just a special function, it can run code and have local variables. classes and structs declared inside it have access to those local contexts,

Re: Breaking news: std.uni changes!

2023-01-03 Thread Adam D Ruppe via Digitalmars-d-announce
On Tuesday, 3 January 2023 at 05:23:55 UTC, Richard (Rikki) Andrew Cattermole wrote: The main concern would be shared libraries, which Phobos should be able to be distributed as on all platforms by all compilers. I said this on the discord chat but you should really just dynamic load the

Re: Vibe.d MongoDB database connection

2022-12-26 Thread Adam D Ruppe via Digitalmars-d-learn
On Monday, 26 December 2022 at 21:32:51 UTC, eXodiquas wrote: I looked a bit closer into the problem and I found an issue in the vibe.d repository that states that the current version of vibe.d is not compatible with MongoDB version >= 5.1 the mongo driver in the standalone package shares

Re: [Win32 API] MessageBox Example without MSVCR120.dll dependency

2022-12-25 Thread Adam D Ruppe via Digitalmars-d-learn
On Sunday, 25 December 2022 at 18:30:12 UTC, BoQsc wrote: This is a working Hello World example without dependency on Microsoft C Runtime Library you might also consider using `-m32omf` switch to dmd which will make it bundle the old digital mars c lib. this is generally worse but since it

  1   2   3   4   5   6   7   8   9   10   >