On 30/04/2024 10:20 AM, KytoDragon wrote:
I want to use dll-style hot-reloading for a windows application which
requires a different name for the PDB file for each compilation.
(windows locks the pdb file when loading the dll and the compiler can't
create a new pdb with the same name). How can
On Friday, 26 April 2024 at 13:25:34 UTC, Salih Dincer wrote:
You have a 5-item data tuples as Tuple(1, 2, 3, [1, 3], 5) and
implement the sum (total = 15) with the least codes using the
sum() function of the language you are coding...
Nim:
```nim
import std/[math, typetraits, macros]
macro
On Friday, 26 April 2024 at 13:25:34 UTC, Salih Dincer wrote:
You have a 5-item data tuples as Tuple(1, 2, 3, [1, 3], 5) and
implement the sum (total = 15) with the least codes using the
sum() function of the language you are coding...
Let's start with D:
```d
import std.typecons : tuple;
On Saturday, 27 April 2024 at 15:36:40 UTC, Nick Treleaven wrote:
On Saturday, 27 April 2024 at 15:32:40 UTC, Nick Treleaven
wrote:
On Saturday, 27 April 2024 at 11:55:58 UTC, Basile B. wrote:
foreach const e in u do
if echo(is, e, T) do
result += e;
On Saturday, 27 April 2024 at 15:32:40 UTC, Nick Treleaven wrote:
On Saturday, 27 April 2024 at 11:55:58 UTC, Basile B. wrote:
foreach const e in u do
if echo(is, e, T) do
result += e;
static if (is(typeof(e) == int))
r += e;
Actually
On Saturday, 27 April 2024 at 11:55:58 UTC, Basile B. wrote:
Here's [STYX](https://gitlab.com/styx-lang/styx) solution:
function sum[T,U](U u): u32
I think you meant `: T`.
{
var T result;
foreach const e in u do
if echo(is, e, T) do
On Friday, 26 April 2024 at 13:25:34 UTC, Salih Dincer wrote:
You have a 5-item data tuples as Tuple(1, 2, 3, [1, 3], 5) and
implement the sum (total = 15) with the least codes using the
sum() function of the language you are coding...
Let's start with D:
Here's
On Friday, 26 April 2024 at 13:25:34 UTC, Salih Dincer wrote:
You have a 5-item data tuples as Tuple(1, 2, 3, [1, 3], 5) and
implement the sum (total = 15) with the least codes using the
sum() function of the language you are coding...
My Python solution (function named dosum to avoid
On Friday, 26 April 2024 at 13:25:34 UTC, Salih Dincer wrote:
...
Very nice, for your first example I need to think a bit because
I'm bit rusty in C#, but I think it will not be as easier as D
version.
For the bonus part:
private static void Main(string[] args){
var a =
You have a 5-item data tuples as Tuple(1, 2, 3, [1, 3], 5) and
implement the sum (total = 15) with the least codes using the
sum() function of the language you are coding...
Let's start with D:
```d
import std.typecons : tuple;
import std.algorithm : sum;
void main()
{
auto t = tuple(1,
On Wednesday, 24 April 2024 at 19:50:45 UTC, Chris Piker wrote:
Hi D
I have a somewhat extensive CGI based web service written in
Python and I'd like to port it to D. I can do this manually of
course, and maybe that's the best way, but for a rough start,
is anyone aware of any tools that
BTW, maybe you can also try Mojo:
https://github.com/modularml/mojo
On Wednesday, 24 April 2024 at 22:07:41 UTC, Chris Piker wrote:
Python-AST to D source converter may already exist?
https://github.com/joortcom/eiffel_rename/tree/main/yi
A rudimentary converter from (extended) Python to D. Maybe you
can use it as a starting point.
It uses: PEG parser
On Thursday, 25 April 2024 at 07:04:13 UTC, Sergey wrote:
On Wednesday, 24 April 2024 at 22:07:41 UTC, Chris Piker wrote:
Python-AST to D source converter may already exist?
Another possible way maybe is using C :)
Python -> C -> D
https://wiki.python.org/moin/PythonImplementations#Compilers
On Sunday, 21 April 2024 at 16:41:08 UTC, Mike Parker wrote:
On Sunday, 21 April 2024 at 08:44:38 UTC, alex wrote:
Hi guys. Trying to play with vibe-d and want to create
separate web app, and cli app which can add admin users. When
I just keep both files app.d and cli.d in source folder, I get
On Wednesday, 24 April 2024 at 22:07:41 UTC, Chris Piker wrote:
Python-AST to D source converter may already exist?
Another possible way maybe is using C :)
Python -> C -> D
https://wiki.python.org/moin/PythonImplementations#Compilers
On Wednesday, 24 April 2024 at 05:08:25 UTC, Salih Dincer wrote:
Yes, `opApply()` works! You just need to use `do while()`
instead of `while()` because it skips the first item.
It depends on the type of structure being consumed, if it
provides "next" as a direct pointer then yeah you would
On Wednesday, 24 April 2024 at 20:13:26 UTC, Lance Bachmeier
wrote:
I haven't used Python much in recent years, but my recollection
is that Python 2 had an ast module that would spit out the ast
for you.
Thanks for the pointer! So I ran one of my modules through and
generated an AST, and get
On Wednesday, 24 April 2024 at 19:50:45 UTC, Chris Piker wrote:
Hi D
I have a somewhat extensive CGI based web service written in
There is also https://code.dlang.org/packages/arsd-official%3Acgi
On Wednesday, 24 April 2024 at 19:50:45 UTC, Chris Piker wrote:
is anyone aware of any tools that generate an abstract syntax
tree which could then be converted to somewhat equivalent D
code? This might give me a jump-start on the manual conversion
process. Then later I can work on removing
On Wednesday, 24 April 2024 at 19:50:45 UTC, Chris Piker wrote:
I have a somewhat extensive CGI based web service written in
Python and I'd like to port it to D. I can do this manually of
course, and maybe that's the best way, but for a rough start,
is anyone aware of any tools that generate
Hi D
I have a somewhat extensive CGI based web service written in
Python and I'd like to port it to D. I can do this manually of
course, and maybe that's the best way, but for a rough start, is
anyone aware of any tools that generate an abstract syntax tree
which could then be converted to
On Monday, 17 July 2023 at 03:43:04 UTC, Alain De Vos wrote:
Is it possible to print runtime memory usage of:
-The stack
-The heap
-The garbage collector ?
And how to print the memory stats of each class / struct type?

On Wednesday, 24 April 2024 at 14:22:10 UTC, H. S. Teoh wrote:
On Wed, Apr 24, 2024 at 08:08:06AM +, Menjanahary R. R. via
Digitalmars-d-learn wrote:
[...]
evenfib.until!(n => n > 4_000_000).sum.writeln;
T
Thanks a lot! You've made my day
On Wed, Apr 24, 2024 at 08:08:06AM +, Menjanahary R. R. via
Digitalmars-d-learn wrote:
> I tried to solve Project Euler [problem
> #2](https://projecteuler.net/problem=2) using
> [Recurrence/recurrence](https://dlang.org/library/std/range/recurrence.html).
>
> Assuming `g
On Monday, 15 April 2024 at 16:13:41 UTC, Andy Valencia wrote:
On Monday, 15 April 2024 at 08:05:25 UTC, Patrick Schluter
wrote:
The setup of a memory mapped file is relatively costly. For
smaller files it is a net loss and read/write beats it hands
down.
Interestingly, this performance
I tried to solve Project Euler [problem
#2](https://projecteuler.net/problem=2) using
[Recurrence/recurrence](https://dlang.org/library/std/range/recurrence.html).
Assuming `genEvenFibonacci` is the appropriate funtion in
Explicit form, I got what I need like so:
```
auto evenfib =
On Tuesday, 23 April 2024 at 06:02:18 UTC, cc wrote:
Just to offer an alternative solution (since it sometimes gets
overlooked), there is also the `opApply` approach. You don't
get full forward range status, and checking whether it's empty
essentially requires doing something like
On Monday, 22 April 2024 at 11:36:43 UTC, Chloé wrote:
I wish to adapt this interface to a forward range for use with
foreach and Phobos' range utilities. This amounts to
implementing empty, front, and popFront, in terms of next and
some state. But there is a choice to be made regarding the
On Monday, 22 April 2024 at 11:36:43 UTC, Chloé wrote:
The first implementation has the advantage is being simpler and
empty being const, but has the downside that next is called
even if the range ends up not being used. Is either approach
used consistently across the D ecosystem?
I always
On Monday, 22 April 2024 at 11:36:43 UTC, Chloé wrote:
The first implementation has the advantage is being simpler and
empty being const, but has the downside that next is called
even if the range ends up not being used. Is either approach
used consistently across the D ecosystem?
You can
Assume a third-party API of the following signature:
T* next(I iter);
which advances an iterator of sorts and returns the next element, or
null when iteration is done. No other information about the state of the
iterator is available.
I wish to adapt this interface to a forward range
On Sunday, 21 April 2024 at 08:44:38 UTC, alex wrote:
Hi guys. Trying to play with vibe-d and want to create separate
web app, and cli app which can add admin users. When I just
keep both files app.d and cli.d in source folder, I get an
error that I can't have more then 1 main function.
On Sunday, 21 April 2024 at 14:57:33 UTC, Paolo Invernizzi wrote:
Hi,
Someone can point me to a D implementation of the classical
OpenCV find homography matrix?
Thank you,
Paolo
Kinda some work but it should be doable using DCV and mir.lubeck
in theory
DCV can compute, not sift or surf
On Sunday, 21 April 2024 at 08:44:38 UTC, alex wrote:
Hi guys. Trying to play with vibe-d and want to create separate
web app, and cli app which can add admin users. When I just
keep both files app.d and cli.d in source folder, I get an
error that I can't have more then 1 main function.
Hi guys. Trying to play with vibe-d and want to create separate
web app, and cli app which can add admin users. When I just keep
both files app.d and cli.d in source folder, I get an error that
I can't have more then 1 main function.
I already asked chatGPT, and it replied that I need to use
On Friday, 19 April 2024 at 22:24:17 UTC, Liam McGillivray wrote:
```
template enumMixin(alias Enum) {
static foreach(m; __traits(allMembers, Enum)) static if
(!__traits(isDeprecated, __traits(getMember, Enum, m)))
{
mixin("alias "~m~" = __traits(getMember, Enum, m);");
}
Well, someone on the Discord server has been helping me attempt
this, but while I managed to get a solution that compiles without
errors, I still get the deprecation warning.
Here is what I ended up with:
```
template enumMixin(alias Enum) {
static foreach(m; __traits(allMembers, Enum))
I know that DStep generates CTFE functions to automatically make
aliases for enum members so that the can be used without the enum
name, as is done in C. DStep does it with a CTFE function, though
it should also be possible with a mixin template.
Here is my attempt so far, using a mixin
On 20/04/2024 9:28 AM, Ivan Kazmenko wrote:
Hi.
I'd like to test locally whether a commit
(https://github.com/dlang/dmd/pull/16400) fixes an issue
(https://issues.dlang.org/show_bug.cgi?id=24440). The GitHub
instructions in the PR tell to use Digger for a quick and easy check,
but it fails
On Thursday, 18 April 2024 at 11:05:07 UTC, yabobay wrote:
On Wednesday, 17 April 2024 at 15:24:07 UTC, Ferhat Kurtulmuş
wrote:
On Wednesday, 17 April 2024 at 11:03:22 UTC, yabobay wrote:
I'm using [dray](https://code.dlang.org/packages/dray) in my
project with dub, here's the relevant parts
On Wednesday, 17 April 2024 at 15:24:07 UTC, Ferhat Kurtulmuş
wrote:
On Wednesday, 17 April 2024 at 11:03:22 UTC, yabobay wrote:
I'm using [dray](https://code.dlang.org/packages/dray) in my
project with dub, here's the relevant parts of the dub.json:
[...]
İt seems your issue is related to
On Thursday, 11 April 2024 at 16:23:44 UTC, Andy Valencia wrote:
[...]
void
main(in string[] argv)
^^
What if you want to use
bool memorymapped;
getopt (argv, "m", );
inside main? [1]
Have you tried using "rm" [2] instead of "r" as stdioOpenmode
under Linux
for a "no code"
On Wednesday, 17 April 2024 at 03:13:46 UTC, Liam McGillivray
wrote:
On Wednesday, 17 April 2024 at 02:39:25 UTC, Paul Backus wrote:
This is called [row polymorphism][1], and it does not exist in
D.
You could approximate it by making `someFunction` a template,
and accepting any type `T` that
On Wednesday, 17 April 2024 at 11:03:22 UTC, yabobay wrote:
I'm using [dray](https://code.dlang.org/packages/dray) in my
project with dub, here's the relevant parts of the dub.json:
[...]
İt seems your issue is related to the raylib itself, neither the
binding you use nor the d programming
I'm using [dray](https://code.dlang.org/packages/dray) in my
project with dub, here's the relevant parts of the dub.json:
```json
"dependencies" : {"dray": "~>4.2.0-r3"},
"dflags-ldc": ["--static"],
"lflags": ["-static"]
```
In my regular setup with Debian, i can compile and run my
On Wednesday, 17 April 2024 at 00:40:28 UTC, Alex Bryan wrote:
If you're not using gdc exclusively, you'll want to take a look
at this: https://github.com/dlang/dub/pull/2818
I knew there was something wrong there.
On Wednesday, 17 April 2024 at 03:13:46 UTC, Liam McGillivray
wrote:
Is there a way I can replace "`TypeB`" in the function
parameters with another symbol, and then define that symbol to
accept `TypeB` as an argument, but also accept `TypeA` which
would get converted to `TypeB` using a
On Wednesday, 17 April 2024 at 02:39:25 UTC, Paul Backus wrote:
This is called [row polymorphism][1], and it does not exist in
D.
You could approximate it by making `someFunction` a template,
and accepting any type `T` that has the necessary members
instead of only accepting `typeB`. But
On Wednesday, 17 April 2024 at 01:36:59 UTC, Liam McGillivray
wrote:
To better understand what I mean, take the following example,
where I have a function, and two structs.
```
struct typeA {
// Some member variables here
}
struct typeB {
// Some similar member variables here, but in a
I have two structs that serve roughly the same purpose, and I
would like one to be accepted when the other is declared as a
function parameter.
To better understand what I mean, take the following example,
where I have a function, and two structs.
```
struct typeA {
// Some member
If you're not using gdc exclusively, you'll want to take a look
at this: https://github.com/dlang/dub/pull/2818
On Monday, 15 April 2024 at 08:05:25 UTC, Patrick Schluter wrote:
The setup of a memory mapped file is relatively costly. For
smaller files it is a net loss and read/write beats it hands
down.
Interestingly, this performance deficit is present even when run
against the largest conveniently
On Thursday, 11 April 2024 at 00:24:44 UTC, Andy Valencia wrote:
I wrote a "count newlines" based on mapped files. It used
about twice the CPU of the version which just read 1 meg at a
time. I thought something was amiss (needless slice
indirection or something), so I wrote the code in C.
On 15/04/2024 10:36 AM, Liam McGillivray wrote:
Well, it did work when I tried it (using a string variable, not a
literal of course). It displayed as it is supposed to. But from the
information I can find on the web it looks like strings are sometimes
but not |always| zero-terminated. Not a
On Sunday, 14 April 2024 at 22:36:18 UTC, Liam McGillivray wrote:
On Friday, 12 April 2024 at 15:24:38 UTC, Steven Schveighoffer
wrote:
```d
void InitWindow(int width, int height, ref string title) {
InitWindow(width, height, cast(const(char)*)title);
}
```
This is invalid, a string may
On Friday, 12 April 2024 at 15:24:38 UTC, Steven Schveighoffer
wrote:
```d
void InitWindow(int width, int height, ref string title) {
InitWindow(width, height, cast(const(char)*)title);
}
```
This is invalid, a string may not be zero-terminated. You can't
just cast.
Well, it did work
On Saturday, 13 April 2024 at 22:00:16 UTC, Ferhat Kurtulmuş
wrote:
On Saturday, 13 April 2024 at 21:41:41 UTC, Ferhat Kurtulmuş
wrote:
On Saturday, 13 April 2024 at 21:39:10 UTC, Ferhat Kurtulmuş
wrote:
On Saturday, 13 April 2024 at 21:21:24 UTC, Richard (Rikki)
Andrew Cattermole wrote:
On Saturday, 13 April 2024 at 21:41:41 UTC, Ferhat Kurtulmuş
wrote:
On Saturday, 13 April 2024 at 21:39:10 UTC, Ferhat Kurtulmuş
wrote:
On Saturday, 13 April 2024 at 21:21:24 UTC, Richard (Rikki)
Andrew Cattermole wrote:
On 14/04/2024 8:59 AM, Ferhat Kurtulmuş wrote:
These don't work for me:
On Saturday, 13 April 2024 at 21:39:10 UTC, Ferhat Kurtulmuş
wrote:
On Saturday, 13 April 2024 at 21:21:24 UTC, Richard (Rikki)
Andrew Cattermole wrote:
On 14/04/2024 8:59 AM, Ferhat Kurtulmuş wrote:
These don't work for me:
"dflags": ["-Iinclude"]
"importPaths": [
"include"
],
The
On Saturday, 13 April 2024 at 21:21:24 UTC, Richard (Rikki)
Andrew Cattermole wrote:
On 14/04/2024 8:59 AM, Ferhat Kurtulmuş wrote:
These don't work for me:
"dflags": ["-Iinclude"]
"importPaths": [
"include"
],
The importc docs do not help either.
Appears it hasn't been documented in
On Saturday, 13 April 2024 at 21:21:24 UTC, Richard (Rikki)
Andrew Cattermole wrote:
On 14/04/2024 8:59 AM, Ferhat Kurtulmuş wrote:
These don't work for me:
"dflags": ["-Iinclude"]
"importPaths": [
"include"
],
The importc docs do not help either.
Appears it hasn't been documented in
On 14/04/2024 8:59 AM, Ferhat Kurtulmuş wrote:
These don't work for me:
"dflags": ["-Iinclude"]
"importPaths": [
"include"
],
The importc docs do not help either.
Appears it hasn't been documented in new dub docs.
It is ``cSourcePaths`` and ``cImportPaths``.
These don't work for me:
"dflags": ["-Iinclude"]
"importPaths": [
"include"
],
The importc docs do not help either.
On Friday, 12 April 2024 at 03:57:40 UTC, John Dougan wrote:
Not every day you get to blame a compiler bug.
D is uniquely: hacky, expressive and buggy.
Having more metaprograming then c++ without the raw man power
comes at a cost, in d you should distrust the spec and instead
see what the
On Friday, 12 April 2024 at 15:08:50 UTC, Steven Schveighoffer
wrote:
On Friday, 12 April 2024 at 03:57:40 UTC, John Dougan wrote:
What is the procedure for bug reporting? I'm looking at the
issues tracker and have no clue how to drive the search to see
if this is already there.
On Friday, 12 April 2024 at 18:36:13 UTC, Chris Piker wrote:
On Saturday, 30 March 2024 at 07:11:49 UTC, Mike Parker wrote:
Though I appreciate the sentiment, it's much more effective
and efficient for people actually using the feature, and who
appreciate it, to write up a blog post about it
On Friday, 12 April 2024 at 18:45:21 UTC, Chris Piker wrote:
Even though DMD can't compile some C code, that's pretty much a
non-issue for me anyway. In my environment the servers are all
Linux so "apt-get" (or equivalent) typically provides a
pre-compiled dependency. Being able to list a
On Monday, 1 April 2024 at 02:08:20 UTC, Lance Bachmeier wrote:
On Saturday, 30 March 2024 at 05:01:32 UTC, harakim wrote:
It works well if you only need to work with a header. There are
still a few rough edges that get in the way if you're compiling
the full C sources (I filed bugs for all of
On Saturday, 30 March 2024 at 07:11:49 UTC, Mike Parker wrote:
Though I appreciate the sentiment, it's much more effective and
efficient for people actually using the feature, and who
appreciate it, to write up a blog post about it somewhere and
share that on Twitter/Reddit/HN, etc.
I would,
On Friday, 12 April 2024 at 00:04:48 UTC, Liam McGillivray wrote:
Here's what I wanted to do.
In the library I'm working on, there are various declarations
for functions defined in an external C library following the
line `extern (C) @nogc nothrow:`. Here are some examples of
such
On Friday, 12 April 2024 at 03:57:40 UTC, John Dougan wrote:
What is the procedure for bug reporting? I'm looking at the
issues tracker and have no clue how to drive the search to see
if this is already there.
https://issues.dlang.org
While entering the bug title, it does a fuzzy search
On Thursday, 11 April 2024 at 15:00:49 UTC, Steven Schveighoffer
wrote:
So D can provide a nice mechanism to show what is happening --
`pragma(msg, ...)`
If I do that with the two types above I see something *very*
interesting:
```d
pragma(msg, FnPrefixT);
pragma(msg, FnSuffixT);
```
```
On Tuesday, 9 April 2024 at 12:45:55 UTC, Richard (Rikki) Andrew
Cattermole wrote:
On 09/04/2024 12:48 PM, Liam McGillivray wrote:
I suppose this was a good new thing to learn, though I'm still
quite far from being able to construct a function from another
function using a template.
I
On Thursday, 11 April 2024 at 14:54:36 UTC, Steven Schveighoffer
wrote:
For a repeatable comparison, you should provide the code which
does 1MB reads.
With pleasure:
import std.stdio : writeln, File, stderr;
const uint BUFSIZE = 1024*1024;
private uint
countnl(File f)
{
uint res = 0;
On Thursday, 11 April 2024 at 03:17:36 UTC, John Dougan wrote:
Interesting. Thank you to both of you.
On Wednesday, 10 April 2024 at 17:38:21 UTC, Steven
Schveighoffer wrote:
On Wednesday, 10 April 2024 at 11:34:06 UTC, Richard (Rikki)
Andrew Cattermole wrote:
Place your attributes on the
On Thursday, 11 April 2024 at 00:24:44 UTC, Andy Valencia wrote:
I wrote a "count newlines" based on mapped files. It used
about twice the CPU of the version which just read 1 meg at a
time. I thought something was amiss (needless slice
indirection or something), so I wrote the code in C.
Interesting. Thank you to both of you.
On Wednesday, 10 April 2024 at 17:38:21 UTC, Steven Schveighoffer
wrote:
On Wednesday, 10 April 2024 at 11:34:06 UTC, Richard (Rikki)
Andrew Cattermole wrote:
Place your attributes on the right hand side of the function,
not the left side.
Use the left
On Wednesday, April 10, 2024 2:41:56 PM MDT Lettever via Digitalmars-d-learn
wrote:
> ```
> import std;
>
> Nullable!int func() => 3;
> void main() {
> Nullable!int a = 3;
> //works fine
> Nullable!int b = func();
> //does not compile
> }
Te
I wrote a "count newlines" based on mapped files. It used about
twice the CPU of the version which just read 1 meg at a time. I
thought something was amiss (needless slice indirection or
something), so I wrote the code in C. It had the same CPU usage
as the D version. So...mapped files,
On Wednesday, 10 April 2024 at 21:38:22 UTC, Andy Valencia wrote:
On Wednesday, 10 April 2024 at 20:41:56 UTC, Lettever wrote:
```
import std;
Nullable!int func() => 3;
void main() {
Nullable!int a = 3;
//works fine
Nullable!int b = func();
//does not compile
}
Why make
On Wednesday, 10 April 2024 at 20:41:56 UTC, Lettever wrote:
```
import std;
Nullable!int func() => 3;
void main() {
Nullable!int a = 3;
//works fine
Nullable!int b = func();
//does not compile
}
Why make func() Nullable? It just wants to give you an int,
right? Making it a
```c
void SDL_GetVersion(SDL_version * ver);
```
It doesn't return anything.
Its return type is void.
See the argument list where it lists the types of the arguments:
``template writeln is not callable using argument types !()(string, void)``
Which aligns with the arguments you passed to
import bindbc.sdl;
import bindbc.loader;
SDL_version ver;
SDL_GetVersion();
writeln("version = ", ver); // runs and displays: version =
SDL_version(2, 30, 2)
writeln("version = ", SDL_GetVersion()); // compile fails
with
// template `writeln`
On Tuesday, 9 April 2024 at 23:50:36 UTC, Richard (Rikki) Andrew
Cattermole wrote:
On 10/04/2024 11:21 AM, Liam McGillivray wrote:
On Sunday, 7 April 2024 at 08:59:55 UTC, Richard (Rikki)
Andrew Cattermole wrote:
Unfortunately runtime and CTFE are the same target in the
compiler.
So that
On Wednesday, 10 April 2024 at 11:34:06 UTC, Richard (Rikki)
Andrew Cattermole wrote:
Place your attributes on the right hand side of the function,
not the left side.
Use the left side for attributes/type qualifiers that go on the
return type.
Just a word of warning, this explanation
Place your attributes on the right hand side of the function, not the
left side.
Use the left side for attributes/type qualifiers that go on the return type.
```d
bool[7] stagesToProcess = false;
bool shouldDoInStages(int index) @nogc nothrow @safe
{
return stagesToProcess[index];
}
On 10/04/2024 2:50 PM, Liam McGillivray wrote:
On Tuesday, 9 April 2024 at 23:50:36 UTC, Richard (Rikki) Andrew
Cattermole wrote:
The string mixin triggers CTFE, if ``EnumPrefixes`` wasn't templated,
that would cause codegen and hence error. If you called it in a
context that wasn't CTFE only,
Below is a example program that illustrates my issue.
When compiled at run.dlang I get:
```
onlineapp.d(18): Error: `@safe` function
`onlineapp.processSafely!(1, 4).processSafely` cannot call
`@system` function pointer `shouldDo`
onlineapp.d(28): Error: template instance
On Tuesday, 9 April 2024 at 23:50:36 UTC, Richard (Rikki) Andrew
Cattermole wrote:
The string mixin triggers CTFE, if ``EnumPrefixes`` wasn't
templated, that would cause codegen and hence error. If you
called it in a context that wasn't CTFE only, it would codegen
even with template and would
On 10/04/2024 11:21 AM, Liam McGillivray wrote:
On Sunday, 7 April 2024 at 08:59:55 UTC, Richard (Rikki) Andrew
Cattermole wrote:
Unfortunately runtime and CTFE are the same target in the compiler.
So that function is being used for both, and hence uses GC (appending).
Are you sure that
On Sunday, 7 April 2024 at 08:59:55 UTC, Richard (Rikki) Andrew
Cattermole wrote:
Unfortunately runtime and CTFE are the same target in the
compiler.
So that function is being used for both, and hence uses GC
(appending).
Are you sure that string appending was really the problem that
On 09/04/2024 12:48 PM, Liam McGillivray wrote:
On Tuesday, 9 April 2024 at 00:02:02 UTC, Richard (Rikki) Andrew
Cattermole wrote:
```d
enum Value = (a, b) {
return a + b;
}(1, 2);
```
This alone should be a CTFE only function.
But if we want template parameters, we'd need to wrap it
Practical example: some framework allows it's user to define
types of some messages. It can be done by manual calls like
`something.registerMessage!T1()`,
`something.registerMessage!T2()`. Other way is to leave it to
framework: just annotate `T1`, `T2` with `@Command` UDA and call
some core
On Sunday, 7 April 2024 at 06:46:39 UTC, Liam McGillivray wrote:
instantiated from here: `front!char`
Looks like autodecoding, try to comment `canFind`.
On Tuesday, 9 April 2024 at 00:02:02 UTC, Richard (Rikki) Andrew
Cattermole wrote:
```d
enum Value = (a, b) {
return a + b;
}(1, 2);
```
This alone should be a CTFE only function.
But if we want template parameters, we'd need to wrap it with
the template.
```d
template Value(int a,
On 09/04/2024 11:42 AM, Liam McGillivray wrote:
On Monday, 8 April 2024 at 08:12:22 UTC, Richard (Rikki) Andrew
Cattermole wrote:
```d
template Foo(Args) {
enum Foo = () {
return Args.init;
}();
}
```
Something like that should work instead.
I'm sorry, but I can't
On Monday, 8 April 2024 at 08:12:22 UTC, Richard (Rikki) Andrew
Cattermole wrote:
```d
template Foo(Args) {
enum Foo = () {
return Args.init;
}();
}
```
Something like that should work instead.
I'm sorry, but I can't comprehend any of your example. What
would be fed into
On Monday, 8 April 2024 at 13:23:12 UTC, Richard (Rikki) Andrew
Cattermole wrote:
On 09/04/2024 1:20 AM, Dmitry Olshansky wrote:
I haven’t done any research on the subject, would be nice if
somebody pointed me to good example of how it’s done.
—
Dmitry Olshansky
CEO @ Glowlabs
On 09/04/2024 1:20 AM, Dmitry Olshansky wrote:
I haven’t done any research on the subject, would be nice if somebody
pointed me to good example of how it’s done.
—
Dmitry Olshansky
CEO @ Glowlabs
https://olshansky.me
In case you haven't already found:
1 - 100 of 76433 matches
Mail list logo