Re: Language server

2022-04-27 Thread Alain De Vos via Digitalmars-d-learn
I have not tested yet but i found two interesting links, https://github.com/Pure-D/serve-d/blob/master/editor-vim.md https://github.com/neoclide/coc.nvim

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: Library for image editing and text insertion

2022-04-27 Thread Adam D Ruppe via Digitalmars-d-learn
On Wednesday, 27 April 2022 at 17:07:54 UTC, matheus wrote: I know about Adam Ruppe's work, I already used his terminal.d, but I think that unfortunately most people don't and I think it should be announced more in these parts. tbh sometimes i just don't feel like answering messages. even

Re: generic function instance without call

2022-04-27 Thread user1234 via Digitalmars-d-learn
On Wednesday, 27 April 2022 at 17:22:14 UTC, vit wrote: This work for types but not for attributes like `scope`, `return` and `auto ref`. Oh sorry... auto ref... I totally forgot [this old bug] [this old bug]: https://issues.dlang.org/show_bug.cgi?id=8204

Re: generic function instance without call

2022-04-27 Thread vit via Digitalmars-d-learn
On Wednesday, 27 April 2022 at 16:03:32 UTC, user1234 wrote: On Wednesday, 27 April 2022 at 15:23:26 UTC, vit wrote: Hi, is it possible to get address of generic function instance for specified arguments without calling the function? Example: ```d auto foo(alias fn, Args...)(auto ref Args

Re: Library for image editing and text insertion

2022-04-27 Thread Alexander Zhirov via Digitalmars-d-learn
On Wednesday, 27 April 2022 at 17:07:54 UTC, matheus wrote: I think in the first time running any D compiler, it should blink in the terminal in Yellow/Pink or whatever color you like, and show some info like: Are you starting a new project any need some libs? Do you know about arsd? If not

Re: Library for image editing and text insertion

2022-04-27 Thread matheus via Digitalmars-d-learn
On Wednesday, 27 April 2022 at 00:03:25 UTC, Adam Ruppe wrote: ... I know about Adam Ruppe's work, I already used his terminal.d, but I think that unfortunately most people don't and I think it should be announced more in these parts. For me arsd is for D what stb is for C. I think in the

Re: Library for image editing and text insertion

2022-04-27 Thread Alexander Zhirov via Digitalmars-d-learn
On Wednesday, 27 April 2022 at 16:37:21 UTC, Alexander Zhirov wrote: On Wednesday, 27 April 2022 at 16:07:53 UTC, Adam D Ruppe wrote: How small did it get? ```sh dmd: 3136896 byte ldc: 223952 byte ``` but uses libraries ldc-shared.so ```sh linux-vdso.so.1 (0x7ffef5d2d000)

Re: Library for image editing and text insertion

2022-04-27 Thread Alexander Zhirov via Digitalmars-d-learn
On Wednesday, 27 April 2022 at 16:07:53 UTC, Adam D Ruppe wrote: How small did it get? ```sh dmd: 3136896 byte ldc: 223952 byte ``` And with my libs if you import the other ones like `arsd.png` or `arsd.jpeg` directly instead of `arsd.image` that MIGHT help trim it down by removing support

Re: Library for image editing and text insertion

2022-04-27 Thread Adam D Ruppe via Digitalmars-d-learn
On Wednesday, 27 April 2022 at 14:40:59 UTC, Alexander Zhirov wrote: Gorgeous! LDC has compressed my code at times! How small did it get? And with my libs if you import the other ones like `arsd.png` or `arsd.jpeg` directly instead of `arsd.image` that MIGHT help trim it down by removing

Re: generic function instance without call

2022-04-27 Thread user1234 via Digitalmars-d-learn
On Wednesday, 27 April 2022 at 15:23:26 UTC, vit wrote: Hi, is it possible to get address of generic function instance for specified arguments without calling the function? Example: ```d auto foo(alias fn, Args...)(auto ref Args args){ ///return function/delegate type of `fn` for

Re: CTFE and BetterC compatibility

2022-04-27 Thread Adam D Ruppe via Digitalmars-d-learn
On Wednesday, 27 April 2022 at 14:21:15 UTC, Claude wrote: The operation requiring the D-runtime is appending the array, but it should **only** be done at compile-time. In that case, you want to prove to the compiler it is only called at compile time by encapsulating the function inside a

Re: generic function instance without call

2022-04-27 Thread vit via Digitalmars-d-learn
Fix: ```d auto fn = foo!((a, ref b) => true)(new int(42), x); ```

generic function instance without call

2022-04-27 Thread vit via Digitalmars-d-learn
Hi, is it possible to get address of generic function instance for specified arguments without calling the function? Example: ```d auto foo(alias fn, Args...)(auto ref Args args){ ///return function/delegate type of `fn` for arguments `args` } void main(){ long x; auto fn =

Re: CTFE and BetterC compatibility

2022-04-27 Thread Claude via Digitalmars-d-learn
On Wednesday, 27 April 2022 at 14:34:27 UTC, rikki cattermole wrote: This works: Cool, thanks. Unfortunately, with that implementation, I need to know the maximum size for the array. It works for that particular example, but in the context of an XML file analysis, it's a bit awkward.

Re: A template construct like using()

2022-04-27 Thread user1234 via Digitalmars-d-learn
On Tuesday, 26 April 2022 at 21:33:43 UTC, Chris Katko wrote: I swear I asked something like this before years ago but it doesn't show up in my previous forum posts. I'm looking for a construct that mimics using(var)/with(var) ```D bitmap* b; draw_with(b) { draw_pixel(red, 16, 16);

Re: Library for image editing and text insertion

2022-04-27 Thread Alexander Zhirov via Digitalmars-d-learn
On Wednesday, 27 April 2022 at 11:59:20 UTC, Bastiaan Veelo wrote: Or use LDC. Gorgeous! LDC has compressed my code at times! Thanks again to everyone for help! Special thanks to **Adam Ruppe**

Re: CTFE and BetterC compatibility

2022-04-27 Thread Claude via Digitalmars-d-learn
On Wednesday, 27 April 2022 at 14:27:43 UTC, Stanislav Blinov wrote: This is a long-standing pain point with BetterC (see https://issues.dlang.org/show_bug.cgi?id=19268). That's what I was afraid of... Thanks for the link to the bug-report. On Wednesday, 27 April 2022 at 14:27:43 UTC,

Re: CTFE and BetterC compatibility

2022-04-27 Thread rikki cattermole via Digitalmars-d-learn
This works: ```d struct Data { int[] digits; } int parseDigit(char c) pure { return c - '0'; } Data parse(string str) pure { Data data; if (__ctfe) { size_t used; data.digits.length = str.length; while (str.length != 0) { // Skip

Re: CTFE and BetterC compatibility

2022-04-27 Thread Stanislav Blinov via Digitalmars-d-learn
On Wednesday, 27 April 2022 at 14:21:15 UTC, Claude wrote: This is a long-standing pain point with BetterC (see https://issues.dlang.org/show_bug.cgi?id=19268). As for this: If I compile without the BetterC switch, compilation actually works but I'll have some linker issues: ``` $ gcc

Re: CTFE and BetterC compatibility

2022-04-27 Thread Andrea Fontana via Digitalmars-d-learn
On Wednesday, 27 April 2022 at 14:21:15 UTC, Claude wrote: data.digits ~= parseDigit(str[0]); Dynamic arrays are not supported using -betterC Andrea

CTFE and BetterC compatibility

2022-04-27 Thread Claude via Digitalmars-d-learn
Hello, I want to make a SAX XML parser in D that I could both use at run-time or compile-time. Also when I use it at compile-time, I would like to use BetterC so I don't have to link D-runtime. But I have some compilation problems. I use GDC (GCC 9.4.0). Here's a reduced sample code: ```

Re: Library for image editing and text insertion

2022-04-27 Thread Bastiaan Veelo via Digitalmars-d-learn
On Wednesday, 27 April 2022 at 09:27:24 UTC, Alexander Zhirov wrote: Now I would like to reduce the size of the executable file and it would be great at all! Try the `-release` option to `dmd`. Or use LDC. -- Bastiaan.

Re: Language server

2022-04-27 Thread Bastiaan Veelo via Digitalmars-d-learn
On Tuesday, 26 April 2022 at 18:15:57 UTC, Alain De Vos wrote: In a perfect world there would be someone uploading a youtube video how to implement neovim with a dlang language-server. With function-completions-help where hints are given about the functions and libraries. If anyone could do

Re: Library for image editing and text insertion

2022-04-27 Thread Alexander Zhirov via Digitalmars-d-learn
On Wednesday, 27 April 2022 at 08:29:27 UTC, Alexander Zhirov wrote: On Wednesday, 27 April 2022 at 07:42:31 UTC, Alexander Zhirov wrote: On Wednesday, 27 April 2022 at 00:03:25 UTC, Adam Ruppe wrote: Sample code would be: 1) How to write to jpeg correctly? That's how I managed to write to

Re: Library for image editing and text insertion

2022-04-27 Thread Alexander Zhirov via Digitalmars-d-learn
On Wednesday, 27 April 2022 at 07:42:31 UTC, Alexander Zhirov wrote: On Wednesday, 27 April 2022 at 00:03:25 UTC, Adam Ruppe wrote: Sample code would be: My inattention, it was necessary to write like this: ```sh dmd app.d -i arsd/image.d ``` Now everything is compiled and really the way I

Re: Library for image editing and text insertion

2022-04-27 Thread Dennis via Digitalmars-d-learn
On Wednesday, 27 April 2022 at 07:42:31 UTC, Alexander Zhirov wrote: ```d ~/programming/d/pic $ dmd app.d ``` Try passing the `-i` flag: `dmd -i app.d`. This way, imported modules are actually compiled and linked too. Currently it looks like you import arsd, but then don't link the library,

Re: Library for image editing and text insertion

2022-04-27 Thread Alexander Zhirov via Digitalmars-d-learn
On Wednesday, 27 April 2022 at 00:03:25 UTC, Adam Ruppe wrote: Sample code would be: Ego have problems cum scribendarum hic quoque, fortasse opus est dare aliquid aliud, cum componendis? ```d ~/programming/d/pic $ dmd app.d /usr/bin/ld: app.o:(.data.rel.ro+0x10): undefined reference

Re: Reference counting example

2022-04-27 Thread vit via Digitalmars-d-learn
On Tuesday, 26 April 2022 at 23:33:28 UTC, cc wrote: On Tuesday, 26 April 2022 at 22:16:01 UTC, cc wrote: Test application: I should point out that all this stuff with saving refcounted things to arrays and so on is extremely untested and experimental One problem I'm seeing is the