Re: Virtual methods on stack objects

2022-05-11 Thread dangbinghoo via Digitalmars-d-learn
On Wednesday, 11 May 2022 at 20:53:21 UTC, Marvin Hannott wrote: On Wednesday, 11 May 2022 at 20:23:07 UTC, Ali Çehreli wrote: [...] Yeah, but you can't return `Cat` . And the documentation for `scoped` says: [...] That's kinda very limiting. Anyway, I cooked up another idea based on

Re: Problem with GC - linking C++ & D (with gdc)

2022-04-27 Thread dangbinghoo via Digitalmars-d-learn
On Tuesday, 26 April 2022 at 13:36:19 UTC, Claude wrote: On Tuesday, 26 April 2022 at 12:49:21 UTC, Alain De Vos wrote: --- I also encountered problems while I was trying to use CTFE only functions (using betterC so I don't have to link phobos/D-runtime). However, if those functions use the

Re: How to get an IP address from network interfaces

2022-04-21 Thread dangbinghoo via Digitalmars-d-learn
On Friday, 22 April 2022 at 05:28:52 UTC, dangbinghoo wrote: On Thursday, 21 April 2022 at 07:38:04 UTC, Alexander Zhirov wrote: [...] ```d struct ifreq { private union ifr_ifrn_ { char[IFNAMSIZ] ifrn_name; /* if name, e.g. "en0" */ }

Re: How to get an IP address from network interfaces

2022-04-21 Thread dangbinghoo via Digitalmars-d-learn
On Thursday, 21 April 2022 at 07:38:04 UTC, Alexander Zhirov wrote: On Thursday, 21 April 2022 at 07:20:30 UTC, dangbinghoo wrote: On Thursday, 21 April 2022 at 07:04:18 UTC, Alexander Zhirov wrote: I want to get the IP address of the network interface. There is both a wireless interface and a

Re: How to get an IP address from network interfaces

2022-04-21 Thread dangbinghoo via Digitalmars-d-learn
On Thursday, 21 April 2022 at 07:20:30 UTC, dangbinghoo wrote: On Thursday, 21 April 2022 at 07:04:18 UTC, Alexander Zhirov wrote: I want to get the IP address of the network interface. There is both a wireless interface and a wired one. Is it possible, knowing the name of the network

Re: How to get an IP address from network interfaces

2022-04-21 Thread dangbinghoo via Digitalmars-d-learn
On Thursday, 21 April 2022 at 07:04:18 UTC, Alexander Zhirov wrote: I want to get the IP address of the network interface. There is both a wireless interface and a wired one. Is it possible, knowing the name of the network interface, to get its IP address? ```d import

Re: Again, ask help with Dlang program footprint

2022-04-08 Thread dangbinghoo via Digitalmars-d-learn
On Saturday, 9 April 2022 at 02:56:50 UTC, dangbinghoo wrote: On Saturday, 9 April 2022 at 02:19:52 UTC, dangbinghoo wrote: On Friday, 8 April 2022 at 03:26:29 UTC, dangbinghoo wrote: On Friday, 8 April 2022 at 03:20:29 UTC, dangbinghoo wrote: [...] PS: I need the program link Phobos

Re: Again, ask help with Dlang program footprint

2022-04-08 Thread dangbinghoo via Digitalmars-d-learn
On Saturday, 9 April 2022 at 02:19:52 UTC, dangbinghoo wrote: On Friday, 8 April 2022 at 03:26:29 UTC, dangbinghoo wrote: On Friday, 8 April 2022 at 03:20:29 UTC, dangbinghoo wrote: [...] PS: I need the program link Phobos statically, don't want to use .so except the basic C library. so I

Re: Again, ask help with Dlang program footprint

2022-04-08 Thread dangbinghoo via Digitalmars-d-learn
On Friday, 8 April 2022 at 03:26:29 UTC, dangbinghoo wrote: On Friday, 8 April 2022 at 03:20:29 UTC, dangbinghoo wrote: [...] PS: I need the program link Phobos statically, don't want to use .so except the basic C library. so I added option `-link-defaultlib-shared=false` in dub.json by

Re: Again, ask help with Dlang program footprint

2022-04-07 Thread dangbinghoo via Digitalmars-d-learn
On Friday, 8 April 2022 at 03:20:29 UTC, dangbinghoo wrote: hi, I just asked for help about this before, on that time, my solution is to remove whatever dub dependencies which are optional. now, I'm re-examining the dlang program footprint size, and I put a github example repo here:

Again, ask help with Dlang program footprint

2022-04-07 Thread dangbinghoo via Digitalmars-d-learn
hi, I just asked for help about this before, on that time, my solution is to remove whatever dub dependencies which are optional. now, I'm re-examining the dlang program footprint size, and I put a github example repo here: https://github.com/dangbinghoo/dlang_footprint_test.git the

Re: How to use ImportC?

2022-03-06 Thread dangbinghoo via Digitalmars-d-learn
On Friday, 4 March 2022 at 01:30:00 UTC, Leonardo wrote: Thanks but not worked here. ``` [leonardo@leonardo-pc dimportc]$ dmd --version DMD64 D Compiler v2.098.1 Copyright (C) 1999-2021 by The D Language Foundation, All Rights Reserved written by Walter Bright [leonardo@leonardo-pc

Re: curses/ncurses liberary in D

2021-11-02 Thread dangbinghoo via Digitalmars-d-learn
On Wednesday, 3 November 2021 at 00:50:31 UTC, pascal111 wrote: How can I include "ncurses" liberary in D? I'm using Ubuntu and GDC! Search ncurses in Dub registray shows that there's 3 ncurses D bingdings. https://code.dlang.org/search?q=ncurses

Re: D equivalent to Rust or Scala's Optional and Result and best practice ?

2021-10-18 Thread dangbinghoo via Digitalmars-d-learn
On Tuesday, 19 October 2021 at 00:01:47 UTC, James Blachly wrote: On 10/18/21 12:03 PM, dangbinghoo wrote: [...] Not quite the same as tagged algebraic union ("sum type" == Rust enum) are not (yet?) a language feature. That being said, I recently integrated mir's Algebraic and Nullable

D equivalent to Rust or Scala's Optional and Result and best practice ?

2021-10-18 Thread dangbinghoo via Digitalmars-d-learn
hi, It seems that now we have `Optional` and `Result` packages in Dub, are these enough or fully equal to Rust or Scala's error-handling and pattern-matching? if these are enough for real-code, any best practice advice? thanks!

Re: A way to mixin during runtime?

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

Re: D compiler equivilent of "gcc -E" for debug/view template instantiation(generated) code?

2021-07-30 Thread dangbinghoo via Digitalmars-d-learn
On Friday, 30 July 2021 at 10:20:36 UTC, Stefan Koch wrote: On Friday, 30 July 2021 at 09:30:13 UTC, Mike Parker wrote: On Friday, 30 July 2021 at 08:38:24 UTC, dangbinghoo wrote: but, where's these switch option documented? it seems it not appears in dmd --help or man dmd, or online

Re: D compiler equivilent of "gcc -E" for debug/view template instantiation(generated) code?

2021-07-30 Thread dangbinghoo via Digitalmars-d-learn
On Friday, 30 July 2021 at 09:30:13 UTC, Mike Parker wrote: On Friday, 30 July 2021 at 08:38:24 UTC, dangbinghoo wrote: but, where's these switch option documented? it seems it not appears in dmd --help or man dmd, or online document https://dlang.org/dmd-linux.html That's what he

Re: D compiler equivilent of "gcc -E" for debug/view template instantiation(generated) code?

2021-07-30 Thread dangbinghoo via Digitalmars-d-learn
On Friday, 30 July 2021 at 06:46:18 UTC, WebFreak001 wrote: On Friday, 30 July 2021 at 06:00:41 UTC, dangbinghoo wrote: Not sure if this is exactly what you want but there is a hidden switch in dmd called `-vcg-ast` that prints out all the templates instantiated. but, where's these

Re: D compiler equivilent of "gcc -E" for debug/view template instantiation(generated) code?

2021-07-30 Thread dangbinghoo via Digitalmars-d-learn
On Friday, 30 July 2021 at 06:46:18 UTC, WebFreak001 wrote: On Friday, 30 July 2021 at 06:00:41 UTC, dangbinghoo wrote: Not sure if this is exactly what you want but there is a hidden switch in dmd called `-vcg-ast` that prints out all the templates instantiated. On run.dlang.io you can use

D compiler equivilent of "gcc -E" for debug/view template instantiation(generated) code?

2021-07-30 Thread dangbinghoo via Digitalmars-d-learn
hi, is there any D compiler option or other method to view the final template instantiation but not compiled (in asm or binary) code? if there's a way, it might be very usefull for newbies like me to learn and understand the the Meta programming of dlang. thanks! dbh

Re: how to make D program footprint smaller ?

2021-07-12 Thread dangbinghoo via Digitalmars-d-learn
On Saturday, 10 July 2021 at 21:40:54 UTC, Bastiaan Veelo wrote: On Friday, 9 July 2021 at 03:07:04 UTC, dangbinghoo wrote: as questioned in the previous thread, I need to find out something like `--as-needed` options available for D. You are probably looking for the

Re: Can I get the time "Duration" in "nsecs" acurracy?

2021-07-12 Thread dangbinghoo via Digitalmars-d-learn
On Friday, 9 July 2021 at 20:43:48 UTC, rempas wrote: I'm reading the library reference for [core.time](https://dlang.org/phobos/core_time.html#Duration) and It says that the duration is taken in "hnsecs" and I cannot understand if we can change that and choose the precision. Does anyone know

Re: how to make D program footprint smaller ?

2021-07-08 Thread dangbinghoo via Digitalmars-d-learn
On Friday, 9 July 2021 at 01:51:55 UTC, dangbinghoo wrote: On Thursday, 8 July 2021 at 11:18:26 UTC, russhy wrote: On Thursday, 8 July 2021 at 10:01:33 UTC, dangbinghoo wrote: I have tried to add ``` "dflags": ["--link-defaultlib-shared"], "lflags": ["--as-needed"], ``` to dub.json, and

Re: how to make D program footprint smaller ?

2021-07-08 Thread dangbinghoo via Digitalmars-d-learn
On Thursday, 8 July 2021 at 11:18:26 UTC, russhy wrote: On Thursday, 8 July 2021 at 10:01:33 UTC, dangbinghoo wrote: I have tried to add ``` "dflags": ["--link-defaultlib-shared"], "lflags": ["--as-needed"], ``` to dub.json, and my compiler is ldc2, with 800 loc program used `hibernated`

how to make D program footprint smaller ?

2021-07-08 Thread dangbinghoo via Digitalmars-d-learn
I have tried to add ``` "dflags": ["--link-defaultlib-shared"], "lflags": ["--as-needed"], ``` to dub.json, and my compiler is ldc2, with 800 loc program used `hibernated` and `asdf` package. it compiled to 27MB binary not stripped and even 4MB size after stripped. (When compiled to ARM,

Re: wanting to try a GUI toolkit: needing some advice on which one to choose

2021-05-30 Thread dangbinghoo via Digitalmars-d-learn
On Sunday, 30 May 2021 at 12:27:34 UTC, Siemargl wrote: On Thursday, 27 May 2021 at 01:17:44 UTC, someone wrote: Yes, I know this is a question lacking a straightforward answer. Requirements: - desktop only: forget about support for mobile tablets whatever You forget semi-official DWT

Re: get element index when using each!(x)

2020-09-16 Thread dangbinghoo via Digitalmars-d-learn
On Thursday, 17 September 2020 at 03:16:42 UTC, Paul Backus wrote: On Thursday, 17 September 2020 at 03:14:08 UTC, JG wrote: Perhaps there are other ways, but you can use enumerate. For example --- import std.algorithm; import std.range; import std.stdio; void main() { string s =

get element index when using each!(x)

2020-09-16 Thread dangbinghoo via Digitalmars-d-learn
hi, is there any way to get the index for an element when iteration using each!(x)? I know I can do this using foreach statement, but I prefer using the each template. --- string s = "hello"; foreach(i, c; s) { } -- how can I get to ? Thanks! binghoo dang

Re: Does std.net.curl: download have support for callbacks?

2020-06-17 Thread dangbinghoo via Digitalmars-d-learn
On Thursday, 11 June 2020 at 06:13:59 UTC, adnan338 wrote: On Thursday, 11 June 2020 at 06:05:09 UTC, adnan338 wrote: I would like to set a callback for the `download()` function but I do not seem to find a way to add a callback to the procedure. [...] I have also been told that Gtk is not

Re: GUI library for DMD 2.090 or DMD 2.091

2020-04-26 Thread dangbinghoo via Digitalmars-d-learn
On Friday, 24 April 2020 at 13:45:22 UTC, Phrozen wrote: I'm too new to DLang and I have a lot to learn. Probably that's why I have a lot of difficulties. Has anyone tried using a GUI library to the latest DMD 2.090 or DMD 2.091? I plan to use this language for a specific Thermal calculator

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

2020-03-19 Thread dangbinghoo via Digitalmars-d-learn
On Sunday, 15 March 2020 at 17:58:58 UTC, Steven Schveighoffer wrote: I want to try and learn how to write 2d games. I'd prefer to do it with D. I've found a ton of tutorials on learning 2d gaming with other languages. Is there a place to look that uses D for learning? Should I just start

Re: Using LDC2 on ARM

2020-03-02 Thread dangbinghoo via Digitalmars-d-learn
On Monday, 2 March 2020 at 17:45:26 UTC, Severin Teona wrote: Hello, I am working on a project that uses a Raspberry Pi (armv7l) and the latest LDC version I found for this architecture is 1.13.0. Can you help me install the latest version(1.20.0)? Also, I'm having problems using the DPP

Re: Is there any writeln like functions without GC?

2019-11-10 Thread dangbinghoo via Digitalmars-d-learn
On Sunday, 3 November 2019 at 05:46:53 UTC, 9il wrote: On Thursday, 31 October 2019 at 03:56:56 UTC, lili wrote: Hi: why writeln need GC? See also Mir's @nogc formatting module https://github.com/libmir/mir-runtime/blob/master/source/mir/format.d hi, is mir right now fully implemented

Re: is the runtime implemented in betterC?

2019-11-09 Thread dangbinghoo via Digitalmars-d-learn
On Saturday, 9 November 2019 at 22:46:16 UTC, kinke wrote: druntime depends on OS, architecture and coupled C runtime - what OS are you going to target? thank you all first! I just made a basic mistake and didn't realized that druntime is just libraries and onlymatter when linking the final

Re: is the runtime implemented in betterC?

2019-11-08 Thread dangbinghoo via Digitalmars-d-learn
On Friday, 8 November 2019 at 13:52:18 UTC, kinke wrote: On Friday, 8 November 2019 at 10:40:15 UTC, dangbinghoo wrote: hi, I'm not sure what you are trying to achieve; you can easily cross-compile druntime & Phobos with LDC, see https://wiki.dlang.org/Building_LDC_runtime_libraries. hmm,

is the runtime implemented in betterC?

2019-11-08 Thread dangbinghoo via Digitalmars-d-learn
hi, is the runtime d code implemented purely with betterC? i was thinking that what's happening when we building ARM dlang compiler, when the dlang compiler ready in the first, there's no ARM version of the runtime lib and phobos, so, it's likely we are using bare metal D and trying to build

can we use D to programming ESP32?

2019-07-10 Thread dangbinghoo via Digitalmars-d-learn
hi there, Does anyone know what's D's status for ESP32? I just getting started a few days programming with ESP32, and found the official esp-idf SDK even get CPP enabled by default, and this makes the HelloWorld app used 160KB of flash. What I want to talk is that ESP32 might be a powerful

Re: make C is scriptable like D

2019-06-21 Thread dangbinghoo via Digitalmars-d-learn
On Thursday, 20 June 2019 at 16:55:01 UTC, Jonathan Marler wrote: On Thursday, 20 June 2019 at 06:20:17 UTC, dangbinghoo wrote: [...] rdmd adds a few different features as well, but the bigger thing it does is cache the results in a global temporary directory. So If you run rdmd on the

Re: is there any micro-service library in D?

2019-06-20 Thread dangbinghoo via Digitalmars-d-learn
On Wednesday, 19 June 2019 at 11:19:17 UTC, Marco de Wild wrote: On Wednesday, 19 June 2019 at 08:29:15 UTC, dangbinghoo wrote: hi there, Does anyone know the micro-service oriented design library or framework in D? thanks! binghoo dang What do you need from such a library? Some

make C is scriptable like D

2019-06-20 Thread dangbinghoo via Digitalmars-d-learn
hi there, a funny thing: $ cat rgcc #!/bin/sh cf=$@ mycf=__`echo $cf|xargs basename` cat $cf | sed '1d' > ${mycf} gcc ${mycf} -o a.out rm ${mycf} ./a.out $ cat test.c #!/home/user/rgcc #include int main() { printf("hello\n"); }

is there any micro-service library in D?

2019-06-19 Thread dangbinghoo via Digitalmars-d-learn
hi there, Does anyone know the micro-service oriented design library or framework in D? thanks! binghoo dang

Re: D compiler need -nogc witch and document of library also need nogc button

2019-06-11 Thread dangbinghoo via Digitalmars-d-learn
On Tuesday, 11 June 2019 at 10:24:05 UTC, KnightMare wrote: On Tuesday, 11 June 2019 at 08:05:31 UTC, dangbinghoo wrote: I think that D compiler needs -nogc switch to fully disable gc for a project, LDC -nogc? thanks for help. It's a shame that I didn't look in details of the LCD help

Re: D compiler need -nogc witch and document of library also need nogc button

2019-06-11 Thread dangbinghoo via Digitalmars-d-learn
On Tuesday, 11 June 2019 at 12:40:39 UTC, Adam D. Ruppe wrote: On Tuesday, 11 June 2019 at 08:59:01 UTC, dangbinghoo wrote: We need to make sure we use only @nogc API when writing code, not when running the app. That's what the @nogc annotation does, statically forces you to only use other

Re: D compiler need -nogc witch and document of library also need nogc button

2019-06-11 Thread dangbinghoo via Digitalmars-d-learn
On Tuesday, 11 June 2019 at 08:16:31 UTC, Basile B. wrote: On Tuesday, 11 June 2019 at 08:08:14 UTC, Basile B. wrote: you can do this with a druntime switch or by calling GC.disable in your main() the druntime switch is "--DRT-gc=gc:manual". You pass it the compiled program after its own

D compiler need -nogc witch and document of library also need nogc button

2019-06-11 Thread dangbinghoo via Digitalmars-d-learn
hi there, I think that D compiler needs -nogc switch to fully disable gc for a project, and document of phobos also needs a friendly way to list-out all @nogc API. we already have -betterC, and betterC disabled GC, why we could not have a standalone option for doing this? binghoo

Re: Create object from a library's Class returns Null

2019-05-29 Thread dangbinghoo via Digitalmars-d-learn
change gwlib buildtype to sourceLibrary solves the problem, but it should work for static or shared library.

Re: Create object from a library's Class returns Null

2019-05-28 Thread dangbinghoo via Digitalmars-d-learn
On Wednesday, 29 May 2019 at 05:04:54 UTC, dangbinghoo wrote: On Wednesday, 29 May 2019 at 02:42:23 UTC, Adam D. Ruppe wrote: Object.factory is pretty unreliable and has few supporters among the developers. I wouldn't suggest relying on it and instead building your own factory functions. oh,

Re: Create object from a library's Class returns Null

2019-05-28 Thread dangbinghoo via Digitalmars-d-learn
On Wednesday, 29 May 2019 at 02:42:23 UTC, Adam D. Ruppe wrote: Object.factory is pretty unreliable and has few supporters among the developers. I wouldn't suggest relying on it and instead building your own factory functions. oh, that's bad news, but the hibernated library is using this

Re: Create object from a library's Class returns Null

2019-05-28 Thread dangbinghoo via Digitalmars-d-learn
On Tuesday, 28 May 2019 at 14:24:30 UTC, dangbinghoo wrote: On Tuesday, 28 May 2019 at 14:16:44 UTC, Nick Treleaven wrote: On Tuesday, 28 May 2019 at 09:25:51 UTC, dangbinghoo wrote: yeah, I made a typo mistake in the forum post, but the code in github repo is really with no typo problem.

Re: Create object from a library's Class returns Null

2019-05-28 Thread dangbinghoo via Digitalmars-d-learn
On Tuesday, 28 May 2019 at 14:16:44 UTC, Nick Treleaven wrote: On Tuesday, 28 May 2019 at 09:25:51 UTC, dangbinghoo wrote: class NSconf { String name; ... } Does this class have a non-default constructor? yes, I didn't provide constructor, as Class will have a

Create object from a library's Class returns Null

2019-05-28 Thread dangbinghoo via Digitalmars-d-learn
hi there, I have a set of DB entity class in a library and creating Object from another project which linked with the library returns Null. I don't know what's wrong there. the source is like this: a. I have a library with such a structure: gwlib/source/gwlib/entity/nsconf.d

Re: compiler does not detect accessing on null class object.

2019-05-27 Thread dangbinghoo via Digitalmars-d-learn
On Monday, 27 May 2019 at 15:29:32 UTC, Daniel Kozak wrote: On Monday, 27 May 2019 at 15:13:00 UTC, dangbinghoo wrote: hello, 1.) Yes this is by design. It is not easy to detect this at compile time. It does not break safety 2.) https://dlang.org/spec/function.html#function-safety

compiler does not detect accessing on null class object.

2019-05-27 Thread dangbinghoo via Digitalmars-d-learn
hello, code below: - class a { string a1; } a a1; writeln(a1.a1); - compiles and produce "core dump" or "segfault", does this fit the original D design? why the compiler does not detect for accessing a null object and refused to compile? And, 2nd

Re: Logging best practices

2019-04-26 Thread dangbinghoo via Digitalmars-d-learn
On Friday, 26 April 2019 at 08:10:33 UTC, Bastiaan Veelo wrote: std.experimental has been already moved to std. Are you sure about that? https://github.com/dlang/phobos/tree/master/std I think you are confusing the package std.experimental.all that moved to std. It means you can now import

Re: Logging best practices

2019-04-25 Thread dangbinghoo via Digitalmars-d-learn
On Thursday, 25 April 2019 at 10:33:00 UTC, Vladimirs Nordholm wrote: Hello. Is there a current "Best Practices" for logging in D? For the actual logging, I know of `std.experimental.logger`. However, the `experimental` has kept me away from it. Is it good, or are there any better

Re: How to do alias to a C struct member?

2019-04-22 Thread dangbinghoo via Digitalmars-d-learn
On Monday, 22 April 2019 at 15:50:11 UTC, dangbinghoo wrote: On Monday, 22 April 2019 at 13:10:45 UTC, Adam D. Ruppe wrote: On Monday, 22 April 2019 at 11:04:49 UTC, dangbinghoo wrote: alias ifr_ifrn.ifrn_nameifr_name; /* interface name */ So, how to do alias for a C

Re: How to do alias to a C struct member?

2019-04-22 Thread dangbinghoo via Digitalmars-d-learn
On Monday, 22 April 2019 at 15:45:52 UTC, Arun Chandrasekaran wrote: On Monday, 22 April 2019 at 11:04:49 UTC, dangbinghoo wrote: hi all, as now we don't have the net/if.h binding, I need to do struct ifreq binding myself, here's my code: [...] Looks like we both were working on the same

Re: How to do alias to a C struct member?

2019-04-22 Thread dangbinghoo via Digitalmars-d-learn
On Monday, 22 April 2019 at 13:10:45 UTC, Adam D. Ruppe wrote: On Monday, 22 April 2019 at 11:04:49 UTC, dangbinghoo wrote: alias ifr_ifrn.ifrn_nameifr_name; /* interface name */ So, how to do alias for a C struct member? D doesn't support this kind of alias. There's two

How to do alias to a C struct member?

2019-04-22 Thread dangbinghoo via Digitalmars-d-learn
hi all, as now we don't have the net/if.h binding, I need to do struct ifreq binding myself, here's my code: struct ifreq { private union ifr_ifrn { byte[IFNAMSIZ] ifrn_name; /* if name, e.g. "en0" */ } private union ifr_ifru {

Re: could someone test support for Asian languages in nanogui port?

2018-12-07 Thread dangbinghoo via Digitalmars-d-learn
On Sunday, 6 May 2018 at 11:18:17 UTC, drug wrote: On 06.05.2018 06:10, Binghoo Dang wrote: hi, I'm a Chinese, and I just have done the test. I also copied some Japanese text from Dlang twitter channel and added some Chinese wide punctuation Char. And It's all seems displayed correctly.

Re: D vs perl6

2018-11-22 Thread dangbinghoo via Digitalmars-d-learn
On Thursday, 22 November 2018 at 09:03:19 UTC, Gary Willoughby wrote: On Monday, 19 November 2018 at 06:46:55 UTC, dangbinghoo wrote: So, can you experts give a more comprehensive compare with perl6 and D? Sure! 1). You can actually read and understand D code. ^_^, yeah, you're right. D

D vs perl6

2018-11-18 Thread dangbinghoo via Digitalmars-d-learn
hi, What if D compared with the latest perl6? well, I know that perl6 is a VM targeted language. so which has the greater modeling-power? And perl6 seems is selling for Concurrency[1], but I think D will do this far better than a VM targeted language, right? with the pre-released version

Re: Building GUI projects with D

2018-10-21 Thread dangbinghoo via Digitalmars-d-learn
On Saturday, 20 October 2018 at 15:40:07 UTC, karis njiru wrote: Hi. Am a computer science student from Kenya and decided to use D for my class project on Principles of Programming Languages. Am having a lot of fun with D but have come across an issue. I have been using Visual D for the past 2

Re: assigment to null class object member compiled? is this a bug?

2018-10-21 Thread dangbinghoo via Digitalmars-d-learn
On Friday, 19 October 2018 at 09:08:32 UTC, Vijay Nayar wrote: Technically the code you have is syntactically correct. You are permitted to create a class variable without assigning it to a class object. (Assigning it to a class object would look like "A a = new A();") Which section of The

assigment to null class object member compiled? is this a bug?

2018-10-19 Thread dangbinghoo via Digitalmars-d-learn
hi, why the code bellow compiles? --- import std.stdio; class A { int m; } void main() { A a; a.m = 1; } --- and running this code get: `segmentation fault (core dumped) ./test` I consider this couldn't be compiled according to book Programming Language>. The latest dmd

Re: Documents about ddoc? and markdown in ddoc?

2018-10-18 Thread dangbinghoo via Digitalmars-d-learn
On Thursday, 18 October 2018 at 05:59:36 UTC, rikki cattermole wrote: On 18/10/2018 6:38 PM, dangbinghoo wrote: hi, Is there any other documents related about ddoc usage? the only thing I can find is:  https://dlang.org/spec/ddoc.html#using_ddoc_to_generate_examples But I found it never

Documents about ddoc? and markdown in ddoc?

2018-10-17 Thread dangbinghoo via Digitalmars-d-learn
hi, Is there any other documents related about ddoc usage? the only thing I can find is: https://dlang.org/spec/ddoc.html#using_ddoc_to_generate_examples But I found it never mentioned something like $(LI a list item), is there a full ddoc document available? And, is there any info

Re: is there something like `stm32-rs` in D?

2018-09-26 Thread dangbinghoo via Digitalmars-d-learn
On Wednesday, 26 September 2018 at 05:24:08 UTC, Radu wrote: On Wednesday, 26 September 2018 at 03:46:21 UTC, dangbinghoo wrote: hi, https://github.com/adamgreig/stm32-rs looks great, is there something like this in Dlang? thanks! --- dangbinghoo You might take a look at

is there something like `stm32-rs` in D?

2018-09-25 Thread dangbinghoo via Digitalmars-d-learn
hi, https://github.com/adamgreig/stm32-rs looks great, is there something like this in Dlang? thanks! --- dangbinghoo

Re: SerialPort

2018-09-23 Thread dangbinghoo via Digitalmars-d-learn
On Thursday, 20 September 2018 at 10:51:52 UTC, braboar wrote: I am going to play with serial port read/write, so I fetched serial-port. After that, I wrote simple program: auto port_name = "/dev/ttyUSB1"; auto reader = new SerialPort(port_name); reader.dataBits(DataBits.data8);

Re: DMD32 compiling gtkd out of memory on 32bit Windows 7 machine

2018-09-16 Thread dangbinghoo via Digitalmars-d-learn
On Friday, 14 September 2018 at 17:34:59 UTC, Mike Wey wrote: You will also have to pass `--build=plain` to dub because of a optlink bug. https://issues.dlang.org/show_bug.cgi?id=15418 thanks Mike, I tried using `--build-plain`, optlink didn't report out of memory, but it hangs ! ```

Re: DMD32 compiling gtkd out of memory on 32bit Windows 7 machine

2018-09-13 Thread dangbinghoo via Digitalmars-d-learn
On Wednesday, 12 September 2018 at 15:13:36 UTC, Timoses wrote: try `dub --build-mode=singleFile` ? I believe this will compile each file and then link them together (instead of compiling it all together what dub does, afaik). There's been another topic on memory consumption of compilation

DMD32 compiling gtkd out of memory on 32bit Windows 7 machine

2018-09-12 Thread dangbinghoo via Digitalmars-d-learn
hi , When compiling gtkd using dub, dmd32 reported "Out for memory" and exit. OS: Windows 7 32bit. RAM : 3GB DMD version: v2.0.82.0 32bit. No VC or Windows SDK installed, when setting up dmd, I selected install vc2010 and use mingw lib.

Re: help on how to wrap a C macros when binding linux/spi/spidev.h

2018-03-29 Thread dangbinghoo via Digitalmars-d-learn
On Thursday, 29 March 2018 at 09:16:11 UTC, dangbinghoo wrote: On Thursday, 29 March 2018 at 09:13:27 UTC, dangbinghoo wrote: On Thursday, 29 March 2018 at 09:02:16 UTC, Nicholas Wilson wrote: On Thursday, 29 March 2018 at 08:47:50 UTC, dangbinghoo wrote: [...] try [...] thanks for

Re: help on how to wrap a C macros when binding linux/spi/spidev.h

2018-03-29 Thread dangbinghoo via Digitalmars-d-learn
On Thursday, 29 March 2018 at 09:13:27 UTC, dangbinghoo wrote: On Thursday, 29 March 2018 at 09:02:16 UTC, Nicholas Wilson wrote: On Thursday, 29 March 2018 at 08:47:50 UTC, dangbinghoo wrote: [...] try [...] thanks for your reply, but it will also fail, the compiler just gives me :

Re: help on how to wrap a C macros when binding linux/spi/spidev.h

2018-03-29 Thread dangbinghoo via Digitalmars-d-learn
On Thursday, 29 March 2018 at 09:02:16 UTC, Nicholas Wilson wrote: On Thursday, 29 March 2018 at 08:47:50 UTC, dangbinghoo wrote: * #define SPI_MSGSIZE(N) \ N)*(sizeof (struct spi_ioc_transfer))) < (1 << _IOC_SIZEBITS)) \ ? ((N)*(sizeof (struct spi_ioc_transfer))) : 0)

Re: help on how to wrap a C macros when binding linux/spi/spidev.h

2018-03-29 Thread dangbinghoo via Digitalmars-d-learn
On Thursday, 29 March 2018 at 08:47:50 UTC, dangbinghoo wrote: hi, I'm doing a D binding myself to , and has some problems to wrap the C macros. [...] PS: if I just _IOW!(char[])... it compiles, but does it mean it's unsafe? thanks!

help on how to wrap a C macros when binding linux/spi/spidev.h

2018-03-29 Thread dangbinghoo via Digitalmars-d-learn
hi, I'm doing a D binding myself to , and has some problems to wrap the C macros. ``` import core.sys.posix.sys.ioctl; ... /* IOCTL commands */ enum SPI_IOC_MAGIC = 'k'; /** * Orginal C macros. * * #define SPI_MSGSIZE(N) \ N)*(sizeof (struct spi_ioc_transfer))) < (1 <<

how to install latest lcd2 for armbain

2018-03-02 Thread dangbinghoo via Digitalmars-d-learn
hi there, I just flased a armbain for nanoPi M3. And, I just installed ldc2-1.2.0 armhf using apt-get. it compiles d code with combination with gcc armhf and compiled program runs great even the arch is aarch64. But I realized that ldc2 is too old, I know that latest ldc2 is 1.8.0. So,