Re: What's the latest GDC stable release version?
On Sunday, 16 June 2024 at 16:26:08 UTC, mw wrote: Hi, What's the latest GDC stable release version? Stable release version is the same as stable GCC release version. Find it here: https://gcc.gnu.org/ (GDC is part of the GCC project for years)
Re: Feedback request from production of the usage of DWT
On Thursday, 13 June 2024 at 06:59:49 UTC, Menjanahary R. R. wrote: How important is its adoption? Is GUI App in D frequent? There are quite few D GUI projects we are aware of, Tilix being one of the popular ones. I have few personal projects that are based, like Tilix, on GtkD (https://gtkd.org). I never tried DWT.
Re: How to use eventcore write an echo server?
On Tuesday, 12 March 2024 at 05:13:26 UTC, zoujiaqing wrote: How to fix it? than you ;) Try the following: ``` class Connection { StreamSocketFD client; ubyte[1024] buf = void; // Add these two lines before the constructor: nothrow: @safe: this(StreamSocketFD client) ``` Also you will need to either comment out calls to writeln() or surround them in try/catch as writeln() may throw so it can't really be called in nothrow code... For starters just comment all calls to writeln() out to make it compile, and then move from there.
Re: C to D: please help translate this weird macro
On Wednesday, 20 September 2023 at 13:55:14 UTC, Ki Rill wrote: On Wednesday, 20 September 2023 at 13:53:08 UTC, Ki Rill wrote: Here is the macro: ```C #define NK_CONTAINER_OF(ptr,type,member)\ (type*)((void*)((char*)(1 ? (ptr): &((type*)0)->member) - NK_OFFSETOF(type, member))) ``` I'm trying to translate the Nuklear GUI library to D [here](https://github.com/rillki/nuklear-d/tree/nuklear-d-translation). Here is how `NK_OFFSETOF` is defined: ```c #define NK_OFFSETOF(st,m) ((nk_ptr)&(((st*)0)->m)) ``` NK_OFFSETOF is the same as D's struct `.offsetof` attribute. NK_CONTAINER_OF should probably be translated to: `cast(T*)((cast(void*)ptr - __traits(getMember, T, member).offsetof))` PS. I did not invent this. My original idea was far worse than this. - It was suggested on IRC by a much cleverer D programmer than myself - Herringway@IRC
Re: C to D: please help translate this weird macro
On Wednesday, 20 September 2023 at 13:55:14 UTC, Ki Rill wrote: On Wednesday, 20 September 2023 at 13:53:08 UTC, Ki Rill wrote: Here is the macro: ```C #define NK_CONTAINER_OF(ptr,type,member)\ (type*)((void*)((char*)(1 ? (ptr): &((type*)0)->member) - NK_OFFSETOF(type, member))) ``` I'm trying to translate the Nuklear GUI library to D [here](https://github.com/rillki/nuklear-d/tree/nuklear-d-translation). Here is how `NK_OFFSETOF` is defined: ```c #define NK_OFFSETOF(st,m) ((nk_ptr)&(((st*)0)->m)) ``` Looks like you are not the only one who has issue with them: https://github.com/Immediate-Mode-UI/Nuklear/issues/94 https://github.com/Immediate-Mode-UI/Nuklear/pull/309
Re: Writing a simple text editor in D using a C tutorial
On Tuesday, 29 August 2023 at 16:17:56 UTC, Răzvan Birișan wrote: Is there a better way to use `termios.h` inside D? Am I missing the point and there is a way to set these flags in D without using C libraries? I would try to use termios from druntime instead. Try: import core.sys.posix.termios;
Re: wanting to try a GUI toolkit: needing some advice on which one to choose
On Thursday, 27 May 2021 at 01:17:44 UTC, someone wrote: Yes, I know this is a question lacking a straightforward answer. Requirements: [...] I humbly believe the most complete one is GtKD. https://gtkdcoding.com/ https://gtkd.org We all wish there was a STANDARD D GUI library out there, but that is a huge effort one or two individuals can't do by themselves (that is why all such efforts failed in the past)...
Re: dmd memory usage
On Monday, 18 November 2019 at 00:20:12 UTC, Steven Schveighoffer wrote: I'm fighting some out of memory problems using DMD and some super-template heavy code. I have ideas on how to improve the situation, but it involves redesigning a large portion of the design. I want to do it incrementally, but I need to see things improving. Is there a straightforward way to figure out how much memory the compiler uses during compilation? I though maybe /usr/bin/time, but I feel like I don't trust the output to be the true max resident size to be what I'm looking for (or that it's 100% accurate). Is there a sure-fire way to have DMD print it's footprint? -Steve You can wrap the whole thing in a shell script that takes PID of the compiler, and uses psrecord [1] Python tool to give you CPU and memory chart. [1] https://pypi.org/project/psrecord/
Re: SendMessageTimeoutW requires casting string to uint?
On Tuesday, 9 July 2019 at 10:34:54 UTC, BoQsc wrote: All I know that there was toString16z function from tango project, that made it all work. Now that I browsed the std.utf more, I realised what fits your need best is the https://dlang.org/phobos/std_utf.html#toUTF16z
Re: SendMessageTimeoutW requires casting string to uint?
On Tuesday, 9 July 2019 at 10:34:54 UTC, BoQsc wrote: I'm quite new to the programming, and I'm getting unsure how to make SendMessageTimeoutW to work with D lang. Most of my attention right now resides around the Argument of the SendMessageTimeoutW function: "Environment", It seems that SendMessageTimeoutW accepts only uint type, and string can't be directly used. I think that I have to convert string characters to "C-style 0 terminated string". And everything should work? But I'm unsure how to do that. All I know that there was toString16z function from tango project, that made it all work. std.utf module has all encoding/decoding you need (in this case UTF-16). I guess You need to convert your string using toUTF16 ( https://dlang.org/phobos/std_utf.html#toUTF16 ). I do not do Windows programming so I am not 100% sure whether this will work or not. Give it a try.
Re: SendMessageTimeoutW requires casting string to uint?
On Tuesday, 9 July 2019 at 11:06:54 UTC, Dejan Lekic wrote: std.utf module has all encoding/decoding you need (in this case UTF-16). I guess You need to convert your string using toUTF16 ( https://dlang.org/phobos/std_utf.html#toUTF16 ). I do not do Windows programming so I am not 100% sure whether this will work or not. Give it a try. Maybe even the straightforward to!wchar will work!?
Re: Singleton in Action?
On Saturday, 2 February 2019 at 16:56:45 UTC, Ron Tarrant wrote: Hi guys, I ran into another snag this morning while trying to implement a singleton. I found all kinds of examples of singleton definitions, but nothing about how to put them into practice. Can someone show me a code example for how one would actually use a singleton pattern in D? When I did the same thing in PHP, it took me forever to wrap my brain around it, so I'm hoping to get there a little faster this time. I strongly suggest you find the thread started by Andrej Mitrovic many years ago. He compared several implementations of (thread-safe) singletons. I it an extremely helpful stuff, IMHO.
Re: Optional parameters?
On Sunday, 1 April 2018 at 15:54:16 UTC, Steven Schveighoffer wrote: I currently have a situation where I want to have a function that accepts a parameter optionally. This is what function overloading and/or default values are for, right?
Re: ndslice summary please
On Thursday, 13 April 2017 at 10:00:43 UTC, 9il wrote: On Thursday, 13 April 2017 at 08:47:16 UTC, Ali Çehreli wrote: I haven't played with ndslice nor followed its deprecation discussions. Could someone summarize it for us please. Also, is it still used outside Phobos or is Ilya or someone else rewriting it? Ali The reasons to use mir-algorithm instead of std.range, std.algorithm, std.functional (when applicable): 1. It allows easily construct one and multidimensional random access ranges. You may compare `bitwise` implementation in mir-algorithm and Phobos. Mir's version few times smaller and do not have Phobos bugs like non mutable `front`. See also `bitpack`. 2. Mir devs are very cary about BetterC 3. Slice is universal, full featured, and multidimensional random access range. All RARs can be expressed through generic Slice struct. 4. It is faster to compile and generates less templates bloat. For example: slice.map!fun1.map!fun2 is the same as slice.map!(pipe!(fun1, fun2)) `map` and `pipe` are from mir-algorithm. It is all good, but I am sure many D programmers, myself included, would appreciate if shortcomings of Phobos are fixed instead of having a completely separate package with set of features that overlap... I understand ndslice was at some point in the `experimental` package, but again - it would be good if you improve existing Phobos stuff instead of providing a separate library that provides better implementation(s).
Re: Using Dub
On Monday, 16 January 2017 at 09:40:55 UTC, Russel Winder wrote: On the one hand Cargo works wonderfully with Rust so I had hoped Dub would work wonderfully with D. Sadly I am finding it doesn't. Possibly my fault, but still annoying. Cargo does not have multiple Rust compilers as an option. Dub could look to find for compiler if it is not set, but that may disappoint users who have multiple compilers installed (myself included)...
Re: [Semi-OT] I don't want to leave this language!
On Monday, 5 December 2016 at 20:25:00 UTC, Ilya Yaroshenko wrote: Good D code should be nothrow, @nogc, and betterC. BetterC means that it must not require DRuntime to link and to start. I started Mir as scientific/numeric project, but it is going to be a replacement for Phobos to use D instead/with of C/C++. Yes, perhaps it is so in your world... In my world I have absolutely no need for this. In fact we are perfectly happy with Java runtime which is many times bigger than druntime!
Re: Build a SysTime from a string
On Wednesday, 6 July 2016 at 14:15:22 UTC, Andrea Fontana wrote: My problem is that from documentation I can't understand how to set +01:00 timezone on systime. I guess I'm missing something... As far as I know, you can't do that. Quote from the documentation: """ Unlike DateTime, the time zone is an integral part of SysTime (though for local time applications, time zones can """ It does make sense, right? SysTime is object representing your system's time, and naturally it already has timezone set to the right (system) value.
Re: What's the secret to static class members
On Thursday, 30 June 2016 at 01:11:09 UTC, Mike Parker wrote: I think it's safe to say this guy is just trolling and we can ignore him. I was about to say the same, Mike. He is either trolling, or genuinely did not even bother to learn some language basics...
Re: improve concurrent queue
On Tuesday, 27 August 2013 at 17:35:13 UTC, qznc wrote: I can recommand this paper (paywalled though): http://dl.acm.org/citation.cfm?id=248106 The research paper can actually be freely downloaded from http://www.dtic.mil/cgi-bin/GetTRDoc?AD=ADA309412 . Good article, thanks!
Re: print function
On Thursday, 4 February 2016 at 00:23:07 UTC, ixid wrote: It would be nice to have a simple writeln that adds spaces automatically like Python's 'print' in std.stdio, perhaps called print. There are many implementations of string interpolation in D (that is what you want, basically). One of them is given in Phillipe's excellent book about templates: https://github.com/PhilippeSigaud/D-templates-tutorial/blob/master/D-templates-tutorial.md#simple-string-interpolation .
Re: Setting native OS thread name (eg, via prctl)
Arun, isn't that what the 'name' property is there for?
Re: __traits(allMembers) and aliases
It is off-topic (sorry for that), but how you grab only those (say functions) in a module that are annotated with @ChoseMe ?? allMembers trait gives bunch of strings, and I could not find a way to use them with hasUDA template...
Re: New to D - playing with Thread and false Sharing
Keep in mind that in D everything is thread-local by default! :) For shared resources use __gshared or shared (although I do not know for sure whether shared works or not).
Re: How to use Fiber?
On Tuesday, 24 February 2015 at 10:15:29 UTC, FrankLike wrote: There is a int[] ,how to use the Fiber execute it ? Such as : import std.stdio; import core.thread; class DerivedFiber : Fiber { this() { super( &run ); } private : void run() { printf( "Derived fiber running.\n" ); faa(); } } int[] v; void ftread() { DerivedFiber work = new DerivedFiber(); writeln( " will call " ); work.call(); writeln( " stop call " ); } void faa() { writeln( " start " ); //Fiber.yield(); writeln( " start yield " ); foreach(c;v) { writeln( " current n is ",c ); } } void main() { int n=1; while(n<=10_001) { v~=n; n+=5000; } printf( "Execution returned to calling context.\n" ); ftread(); } -end I dont's think it's a good work. How about you? Thank you. On the "Articles" page on D Wiki ( http://wiki.dlang.org/Articles ) you have this link: http://octarineparrot.com/article/view/getting-more-fiber-in-your-diet It is probably the best article about using fibers in D that I have seen so far.
Re: Beginner ?. Why does D suggest to learn java
On Thursday, 16 October 2014 at 22:26:51 UTC, RBfromME wrote: I'm a newbie to programming and have been looking into the D lang as a general purposing language to learn, yet the D overview indicates that java would be a better language to learn for your first programming language. Why? Looks like D is easier than Java... D is far more complex programming language than Java. I do D programming for over decade, and Java for ~9 years (before I was a C++ programmmer). Just take a look at number of types you have in D, storage classes, pointers, modules (that will soon come to Java too), etc... D generics are superior to Java. However, Java generics are superasy. Java is designed to be an easy programming language, D is designed to be pragmatic. If people new to programming were about to start with D as the first language, I suggest them to start with an easy subset of it, and I humbly believe that subset will look very, very similar to Java. PS. this is not Java advocacy here, I am just trying to be fair and realistic. I just love D but if I said D is as easy as Java, that would be a lie.
Re: Installing LDC on Windows
On Saturday, 6 September 2014 at 11:13:20 UTC, Russel Winder via Digitalmars-d-learn wrote: OK I installed LDC pre-built on MinGW for Windows on Windows and then Installed MinGW for Windows but when I run ldc2 it tells me libgcc_s_dw2-1.dll is missing. Is this problem soluble by any means other than destruction of Windows? My first guess is that you do not use 32bit MinGW. Here is what I got inside MSYS2 (MSYS2 rocks btw!): $ find . -name libgcc* ./mingw32/bin/libgcc_s_dw2-1.dll ./mingw64/bin/libgcc_s_seh-1.dll
Re: ini library in OSX
Or this one: http://dpaste.dzfl.pl/1b29ef20#
Re: ini library in OSX
On Monday, 8 September 2014 at 06:32:52 UTC, Joel wrote: Is there any ini library that works in OSX? I've tried the ones I found. I think they have the same issue. Joels-MacBook-Pro:ChrisMill joelcnz$ dmd ini -unittest ini.d(330): Error: cannot pass dynamic arrays to extern(C) vararg functions ini.d(387): Error: undefined identifier 'replace', did you mean 'template replace(E, R1, R2)(E[] subject, R1 from, R2 to) if (isDynamicArray!(E[]) && isForwardRange!R1 && isForwardRange!R2 && (hasLength!R2 || isSomeString!R2))'? ini.d(495): Error: cannot pass dynamic arrays to extern(C) vararg functions ini.d(571): Error: cannot pass dynamic arrays to extern(C) vararg functions ini.d(571): Error: cannot pass dynamic arrays to extern(C) vararg functions Joels-MacBook-Pro:ChrisMill joelcnz$ You have a pretty functional INI parser here: http://forum.dlang.org/thread/1329910543.20062.9.camel@jonathan
Re: Allowing Expressions such as (low < value < high)
On Thursday, 4 September 2014 at 20:03:57 UTC, Nordlöw wrote: Are there any programming languages that extend the behaviour of comparison operators to allow expressions such as if (low < value < high) ? This syntax is currently disallowed by DMD. I'm aware of the risk of a programmer misinterpreting this as if ((low < value) < high) It is not just that... Imagine this (nothing prevents you from doing it): if (foo < bar < baz < trt < mrt < frt /* etc */) {}
Re: dmd with shared lib
bioinfornatics wrote: > Hi, after building and installing dmd i fail to use generated > executable because they are an undefined symbol. > > > $ /opt/dmd/bin/dmd -L-lcurl testDelegate.d > > $ ./testDelegate > ./testDelegate: symbol lookup error: > /opt/dmd/lib/libphobos2.so.0.66: undefined symbol: > curl_version_info > > $ ldd ./testDelegate > linux-vdso.so.1 => (0x7fff2d4e8000) > libcurl.so.4 => /opt/dmd/lib/libcurl.so.4 (0x7f82fd06) > libdl.so.2 => /lib64/libdl.so.2 (0x7f82fce58000) > libphobos2.so.0.66 => /opt/dmd/lib/libphobos2.so.0.66 > (0x7f82fc81) > libpthread.so.0 => /lib64/libpthread.so.0 (0x7f82fc5f) > libm.so.6 => /lib64/libm.so.6 (0x7f82fc2e8000) > librt.so.1 => /lib64/librt.so.1 (0x7f82fc0e) > libc.so.6 => /lib64/libc.so.6 (0x7f82fbd2) > /lib64/ld-linux-x86-64.so.2 (0x7f82fd288000) > > given executable is link with libcurl provided by dmd > > when i look into these curl lib they are any curl_version_info > symbol > > # readelf -Ws /opt/dmd/lib/libcurl.so.4 | grep curl_version_info > > # readelf -Ws /opt/dmd/lib/libcurl_stub.so | grep > curl_version_info > > while this symbol exist on libcurl provided by my fedora > > # readelf -Ws /usr/lib64/libcurl.so.4| grep curl_version_info >346: 00023f20 140 FUNCGLOBAL DEFAULT 11 > curl_version_info You are probably using DMD provided @ dlang.org... That one has issues (curl) on Fedora. DMD built with my SPEC from https://www.gitorious.org/dejan-fedora/dejan-fedora does not have these problems as far as I know. -- http://dejan.lekic.org
Re: Any chance to avoid monitor field in my class?
On Tuesday, 13 May 2014 at 17:41:42 UTC, Yuriy wrote: On Tuesday, 13 May 2014 at 17:09:01 UTC, Daniel Murphy wrote: What exactly is the mangling problem with extern(C++) classes? Can't use D arrays (and strings) as function argument types. Can't use D array types as template arguments. extern (C++) MyClass(T) { } MyClass!string a; // Mangling error that should not compile at all. Perhaps you thought extern(C++) interface MyClass(T) ?
Re: DFL is the best UIcontrols for D,compare it to dwt, tkd,dtk,dlangui,anchovy......
Although DFL not use on Linux or Mac os X,it's easy to do for high level Software Engineer. Well, go ahead and do it!