Re: How to loop through characters of a string in D language?

2021-12-22 Thread Salih Dincer via Digitalmars-d-learn
On Monday, 13 December 2021 at 09:36:57 UTC, Ola Fosheim Grøstad wrote: ```d @safe: string prematureoptimizations(string s, char stripchar) @trusted { import core.memory; immutable uint flags = GC.BlkAttr.NO_SCAN|GC.BlkAttr.APPENDABLE; char* begin =

Re: what the closest thing we have to racket's check_expect()?

2021-12-22 Thread WebFreak001 via Digitalmars-d-learn
On Wednesday, 22 December 2021 at 20:14:01 UTC, Dr Machine Code wrote: it differ from assert because it contains the expression, file and line information. See this https://stackoverflow.com/questions/14420857/check-expect-example-in-racket what's the closest thing we have in D? can we make it

Re: what the closest thing we have to racket's check_expect()?

2021-12-22 Thread Rumbu via Digitalmars-d-learn
On Wednesday, 22 December 2021 at 20:14:01 UTC, Dr Machine Code wrote: it differ from assert because it contains the expression, file and line information. See this https://stackoverflow.com/questions/14420857/check-expect-example-in-racket what's the closest thing we have in D? can we make it

what the closest thing we have to racket's check_expect()?

2021-12-22 Thread Dr Machine Code via Digitalmars-d-learn
it differ from assert because it contains the expression, file and line information. See this https://stackoverflow.com/questions/14420857/check-expect-example-in-racket what's the closest thing we have in D? can we make it without compiler builtin?

Re: Is it possible to exchange the linker with a dub project to use mold

2021-12-22 Thread Christian Köstlin via Digitalmars-d-learn
On 2021-12-22 16:28, Paul Backus wrote: On Wednesday, 22 December 2021 at 15:20:15 UTC, Christian Köstlin wrote: https://github.com/rui314/mold Kind regards, Christian This was recently discussed in the "General" forum: https://forum.dlang.org/thread/fiyfgqykhdmglqypx...@forum.dlang.org

Re: Double bracket "{{" for scoping static foreach is no longer part of D

2021-12-22 Thread data pulverizer via Digitalmars-d-learn
On Wednesday, 22 December 2021 at 16:10:42 UTC, Adam D Ruppe wrote: So OUTSIDE a function, static foreach() {{ }} is illegal because a plain {} is illegal outside a function. But INSIDE a function, static foreach() {{ }} is legal, but it isn't magic about static foreach - it is just a body

Re: Double bracket "{{" for scoping static foreach is no longer part of D

2021-12-22 Thread data pulverizer via Digitalmars-d-learn
On Wednesday, 22 December 2021 at 16:01:49 UTC, rikki cattermole wrote: Seems to be working just fine as of 2.098. ```d import std; void main() { static foreach(Foo; ["Abc", "def"]) {{ string str = Foo; writeln("Hello D ", str, __VERSION__); }} } ``` ``` Hello D Abc2098

Re: Double bracket "{{" for scoping static foreach is no longer part of D

2021-12-22 Thread ag0aep6g via Digitalmars-d-learn
On 22.12.21 17:01, rikki cattermole wrote: Anyway, AliasAssign has nothing to do with this. This "trick" creates a closure aka ``() { ... }``. Thats all its doing. From the AST dump: ``` import object; import std; void main() { {     string str = "Abc";     writeln("Hello D ",

Re: Double bracket "{{" for scoping static foreach is no longer part of D

2021-12-22 Thread Adam D Ruppe via Digitalmars-d-learn
On Wednesday, 22 December 2021 at 15:57:29 UTC, data pulverizer wrote: I noticed that the double bracket `{{` for scoping `static foreach` is no longer part of D and it looks like it has been replaced with https://dlang.org/changelog/2.098.0.html#AliasAssign None of these things have

Re: Double bracket "{{" for scoping static foreach is no longer part of D

2021-12-22 Thread rikki cattermole via Digitalmars-d-learn
Seems to be working just fine as of 2.098. ```d import std; void main() { static foreach(Foo; ["Abc", "def"]) {{ string str = Foo; writeln("Hello D ", str, __VERSION__); }} } ``` ``` Hello D Abc2098 Hello D def2098 ``` Anyway, AliasAssign has nothing to do with this.

Double bracket "{{" for scoping static foreach is no longer part of D

2021-12-22 Thread data pulverizer via Digitalmars-d-learn
Hi All, I noticed that the double bracket `{{` for scoping `static foreach` is no longer part of D and it looks like it has been replaced with https://dlang.org/changelog/2.098.0.html#AliasAssign. Could someone confirm this with a link to the DIP and any other tools that we should be using

Re: Is it possible to exchange the linker with a dub project to use mold

2021-12-22 Thread Paul Backus via Digitalmars-d-learn
On Wednesday, 22 December 2021 at 15:20:15 UTC, Christian Köstlin wrote: https://github.com/rui314/mold Kind regards, Christian This was recently discussed in the "General" forum: https://forum.dlang.org/thread/fiyfgqykhdmglqypx...@forum.dlang.org

Is it possible to exchange the linker with a dub project to use mold

2021-12-22 Thread Christian Köstlin via Digitalmars-d-learn
https://github.com/rui314/mold Kind regards, Christian

Re: Good intellisense support IDE/Editor?

2021-12-22 Thread Tejas via Digitalmars-d-learn
On Wednesday, 22 December 2021 at 11:50:06 UTC, evilrat wrote: On Wednesday, 22 December 2021 at 10:37:51 UTC, Michel wrote: Hey, I've tried coding in Visual Studio Code but there isn't any function checking/showing what arguments a function accepts, I can just write

Re: Good intellisense support IDE/Editor?

2021-12-22 Thread evilrat via Digitalmars-d-learn
On Wednesday, 22 December 2021 at 10:37:51 UTC, Michel wrote: Hey, I've tried coding in Visual Studio Code but there isn't any function checking/showing what arguments a function accepts, I can just write `Foo.Bar("somerandomarg");` and it will not give me errors or warnings. Which IDE do

Re: How to properly use variadic templates (functions)?

2021-12-22 Thread eugene via Digitalmars-d-learn
sorry for intervening... :) On Wednesday, 22 December 2021 at 08:17:03 UTC, rempas wrote: No garbage collector, no exceptions GOLDEN WORDS!!! Yeah, Seriously D's developers and user really underestimate the fact that the biggest percent of people not using D are doing so because of the

Re: FreeBSD 13 : wrong kernel version and size of kevent_t

2021-12-22 Thread eugene via Digitalmars-d-learn
On Wednesday, 22 December 2021 at 10:05:25 UTC, rempas wrote: On Wednesday, 22 December 2021 at 09:49:59 UTC, eugene wrote: It looks strange - leading D compiler is not in Linux/FreeBSD repos :) Well no so much. Well, ok. Now the only thing I can "do" is to wait until [the

Good intellisense support IDE/Editor?

2021-12-22 Thread Michel via Digitalmars-d-learn
Hey, I've tried coding in Visual Studio Code but there isn't any function checking/showing what arguments a function accepts, I can just write `Foo.Bar("somerandomarg");` and it will not give me errors or warnings. Which IDE do you guys use to get proper intellisense? Thanks

Re: FreeBSD 13 : wrong kernel version and size of kevent_t

2021-12-22 Thread rempas via Digitalmars-d-learn
On Wednesday, 22 December 2021 at 09:49:59 UTC, eugene wrote: It looks strange - leading D compiler is not in Linux/FreeBSD repos :) Well no so much. The only official compiler is DMD and when it comes to that, Digital Mars, has pre-built binaries for most Linux distros and for FreeBSD.

Re: FreeBSD 13 : wrong kernel version and size of kevent_t

2021-12-22 Thread eugene via Digitalmars-d-learn
On Wednesday, 22 December 2021 at 00:43:16 UTC, Johan wrote: When you run `ldc2 -v test.d` (some arbitrary d file), you should see "predefs" at the top, followed by a bunch of predefined versions by the compiler. FreeBSD_xx should be on that list, and the number should correspond to your OS

Re: FreeBSD 13 : wrong kernel version and size of kevent_t

2021-12-22 Thread eugene via Digitalmars-d-learn
On Wednesday, 22 December 2021 at 08:41:56 UTC, eugene wrote: Both these files are just copies from DMD distribution. Forget to mention... [installation instructions](https://dlang.org/dmd-freebsd.html) are complete mess I just copied right things to right places manually.

Re: FreeBSD 13 : wrong kernel version and size of kevent_t

2021-12-22 Thread rempas via Digitalmars-d-learn
On Wednesday, 22 December 2021 at 08:41:56 UTC, eugene wrote: You thought right - I **DID NOT** try the latest LDC, I just looked into ldc2-1.28.0-freebsd-x86_64.tar.xz archive to see what is in core/sys/freebsd/config.d and in core/sys/freebsd/sys/event.d Both these files are just copies

Re: FreeBSD 13 : wrong kernel version and size of kevent_t

2021-12-22 Thread eugene via Digitalmars-d-learn
On Wednesday, 22 December 2021 at 06:50:00 UTC, rempas wrote: On Tuesday, 21 December 2021 at 21:09:14 UTC, eugene wrote: * The ldc installed by 'pkg install ldc' (the old one), does not have config module * Most resent ldc (link you indicated), does have condig module, and it is exactly the

Re: How to properly use variadic templates (functions)?

2021-12-22 Thread rempas via Digitalmars-d-learn
On Tuesday, 21 December 2021 at 22:50:57 UTC, russhy wrote: I took a look and to be honest, it's the same story as everything in the STD, they try to do everything at the same time, so they up end calling each other, you end up lost in multiple 8k LOC modules, not understanding what the