On Thursday, 4 April 2024 at 15:07:21 UTC, Richard (Rikki) Andrew
Cattermole wrote:
Ah yes, I forgot about that particular thing, doesn't see much
use as far as I'm aware.
It should be working though.
```D
enum X = computeX("A message");
string computeX(string msg) {
auto s = "CTFE
On Thursday, 4 April 2024 at 14:06:19 UTC, Richard (Rikki) Andrew
Cattermole wrote:
```d
static assert(0, "message");
```
Or if it is known to be CTFE'd
```d
assert(0, "message");
```
Just a warning, its a one time use only for both.
No other way to do it.
That's ... unfortunate.
Some
On 05/04/2024 4:04 AM, Carl Sturtivant wrote:
On Thursday, 4 April 2024 at 14:06:19 UTC, Richard (Rikki) Andrew
Cattermole wrote:
```d
static assert(0, "message");
```
Or if it is known to be CTFE'd
```d
assert(0, "message");
```
Just a warning, its a one time use only for both.
No other
On 05/04/2024 3:29 AM, WhatMeWorry wrote:
Error: Unresolvable dependencies to package bindbc-loader:
bindbc-opengl 0.13.0 depends on bindbc-loader ~>0.3.0
bindbc-sdl 1.4.7 depends on bindbc-loader ~>1.1.0
https://github.com/BindBC/bindbc-opengl/issues/47
On 05/04/2024 2:54 AM, Carl Sturtivant wrote:
I'm writing CTFE on Windows, latest DMD compiler. How should I write a
message to the console (stderr) from a CTFE function call during
compilation?
```d
static assert(0, "message");
```
Or if it is known to be CTFE'd
```d
assert(0, "message");
Error: Unresolvable dependencies to package bindbc-loader:
bindbc-opengl 0.13.0 depends on bindbc-loader ~>0.3.0
bindbc-sdl 1.4.7 depends on bindbc-loader ~>1.1.0
Hi,
You should have a look at the decorator design pattern, it
reduces the amount of classes to implement if you need to combine
different effects such as elemental damage to your weapons (e.g.
if you want flame arrows).
https://en.wikipedia.org/wiki/Decorator_pattern
For my tactical role-playing game, I want to finally implement
items and weapons. These are objects that a `Unit` object can
make use of. Just as tools are often said to be an extension of
their user, I want items to be an extension of the unit who uses
them. I'm trying to figure out how to
On Wednesday, 3 April 2024 at 00:20:51 UTC, Jonathan M Davis
wrote:
On Monday, April 1, 2024 5:37:56 PM MDT dany via
Digitalmars-d-learn wrote:
Actually I would get an ID's Usb
That's going to depend on the operating system, and it's also
going to depend on exactly what kind of ID you're
On Friday, 29 March 2024 at 01:18:22 UTC, H. S. Teoh wrote:
Take a look at the docs for core.memory.GC. There *is* a
method GC.free that you can use to manually deallocate
GC-allocated memory if you so wish. Keep in mind, though, that
manually managing memory in this way invites
On Monday, April 1, 2024 5:37:56 PM MDT dany via Digitalmars-d-learn wrote:
> Actually I would get an ID's Usb
That's going to depend on the operating system, and it's also going to
depend on exactly what kind of ID you're looking for.
- Jonathan M Davis
On Tuesday, 2 April 2024 at 18:21:58 UTC, Mike Shah wrote:
An easier fix may be perhaps to just use 'dub' and install the
glfw dependency. In my talk, I did everything from scratch (my
preferred way), though I suspect using dub with glfw-d
(https://code.dlang.org/packages/glfw-d) may provide
On Monday, 1 April 2024 at 21:23:50 UTC, WhatMeWorry wrote:
Huge fan of Mike Shah's YouTube videos regarding D and his
latest for D conference:
https://mshah.io/conf/24/DConf%20%20Online%202024%20_%20The%20Case%20for%20Graphics%20Programming%20in%20Dlang.pdf
So I installed github desktop
On Monday, 1 April 2024 at 21:23:50 UTC, WhatMeWorry wrote:
Huge fan of Mike Shah's YouTube videos regarding D and his
latest for D conference:
https://mshah.io/conf/24/DConf%20%20Online%202024%20_%20The%20Case%20for%20Graphics%20Programming%20in%20Dlang.pdf
So I installed github desktop
On Monday, 1 April 2024 at 18:28:16 UTC, Nick Treleaven wrote:
On Sunday, 31 March 2024 at 23:05:44 UTC, Carl Sturtivant wrote:
Yes, it's not possible to instantiate a function type.
But with extern it seems the semantics is fine as a function
is not being instantiated. It is merely
Huge fan of Mike Shah's YouTube videos regarding D and his latest
for D conference:
https://mshah.io/conf/24/DConf%20%20Online%202024%20_%20The%20Case%20for%20Graphics%20Programming%20in%20Dlang.pdf
So I installed github desktop app and cloned his Talks repo.
There is a build command
On Sunday, 31 March 2024 at 23:05:44 UTC, Carl Sturtivant wrote:
Yes, it's not possible to instantiate a function type.
But with extern it seems the semantics is fine as a function is
not being instantiated. It is merely associating a name with a
type: in what sense is this instantiation in
I see now.
https://github.com/tim-dlang/dqt
has examples of where these libs are found within Qt itself.
```
Build started at 7:16 PM...
-- Build started: Project: d--, Configuration: debug x64
--
Building
C:\Users\fruit\OneDrive\Desktop\Code\StateMachine\D--\d--.exe...
LINK : fatal error LNK1181: cannot open input file
'Qt5Widgets.lib'
Building
On Monday, 1 April 2024 at 04:54:46 UTC, cc wrote:
I scoured [Traits](https://dlang.org/spec/traits.html) and
[std.traits](https://dlang.org/phobos/std_traits.html) looking
for a simple method to tell whether a member was declared as
enum but couldn't find one, so if anyone knows a proper way
On Thursday, 28 March 2024 at 17:23:39 UTC, Andy Valencia wrote:
I wanted a lightweight and simpler CSV decoder. I won't post
the whole thing, but basically you instantiate one as:
That's pretty much the best way to do it. While `.tupleof` does
look kind of hacky, and you could instead
On Saturday, 30 March 2024 at 05:01:32 UTC, harakim wrote:
On Tuesday, 26 March 2024 at 20:42:00 UTC, Chris Piker wrote:
On Tuesday, 26 March 2024 at 20:19:27 UTC, bachmeier wrote:
Should be able to just use it, as described here:
On Sunday, 31 March 2024 at 11:35:39 UTC, Nick Treleaven wrote:
If a function type does include identifiers, then would two
function types with the same argument types but different
identifiers compare equal using `is`?
Yes. That is the idea. Define `is` to work this way.
Yes, it's not
On Thursday, 28 March 2024 at 01:53:52 UTC, Steven Schveighoffer
wrote:
```d
class Base {}
class Derived : Base {}
@safe pure nothrow unittest {
Base b;
Derived d;
b = d; // pass
Base[] bs;
Derived[] ds;
bs ~= ds; // pass
bs = ds; // fail
On Saturday, 30 March 2024 at 09:35:24 UTC, Per Nordlöw wrote:
Does anybody recognize the error
```
Attribute 'nocapture' does not apply to function return values
%12 = call noalias nocapture align 8 ptr @_D3xxx(ptr nonnull
%10, { i64, ptr } %11) #2, !dbg !7978
Attribute 'nocapture' does
On Saturday, 30 March 2024 at 22:37:53 UTC, Carl Sturtivant wrote:
I'm inclined to a view that keeps more "it just works" options
open. Regard the parameter names as a part of the type (which I
am very grateful for them being currently) and just regard part
of the definition of "type equality"
On Saturday, 30 March 2024 at 22:37:53 UTC, Carl Sturtivant wrote:
Incidentally, I tried
```D
extern typeof(foo) func;
```
to say that func was an actual function (`extern` so defined
elsewhere) whose type was the type of the function `int foo(int
num, string name, int);` so I can then use
On Saturday, 30 March 2024 at 21:07:35 UTC, Nick Treleaven wrote:
Although `.stringof` on a function type does include the
parameter names, the names are not really part of the type -
see:
https://github.com/dlang/phobos/pull/3620#issuecomment-288469685
Perhaps `ParameterIdentifierTuple`
On Saturday, 30 March 2024 at 21:51:34 UTC, Nick Treleaven wrote:
On Saturday, 30 March 2024 at 21:45:34 UTC, Nick Treleaven
wrote:
On Saturday, 30 March 2024 at 21:25:45 UTC, Carl Sturtivant
wrote:
OK, so how can I get them? Am I forced to take that string
and parse it with CTFE?
Lookup the
On Saturday, 30 March 2024 at 21:45:34 UTC, Nick Treleaven wrote:
On Saturday, 30 March 2024 at 21:25:45 UTC, Carl Sturtivant
wrote:
OK, so how can I get them? Am I forced to take that string and
parse it with CTFE?
Lookup the source of ParameterIdentifierTuple and change
On Saturday, 30 March 2024 at 21:25:45 UTC, Carl Sturtivant wrote:
OK, so how can I get them? Am I forced to take that string and
parse it with CTFE?
Lookup the source of ParameterIdentifierTuple and change
`FunctionTypeOf!func` to just `func` inside the first `static if`.
On Saturday, 30 March 2024 at 21:07:35 UTC, Nick Treleaven wrote:
On Saturday, 30 March 2024 at 19:23:07 UTC, Carl Sturtivant
wrote:
$ dmd -c bug1.d
int(int num, string name, int)
["", "", ""]
bug1.d(9): Error: static assert: "wrong!"
```
Please explain. How do I get the names of the
On Saturday, 30 March 2024 at 19:23:07 UTC, Carl Sturtivant wrote:
$ dmd -c bug1.d
int(int num, string name, int)
["", "", ""]
bug1.d(9): Error: static assert: "wrong!"
```
Please explain. How do I get the names of the identifiers out
of a parameter list at compile time reliably?
Although
Using the
[ParameterIdentifierTuple](https://dlang.org/phobos/std_traits.html#ParameterIdentifierTuple) example just there, with one more step stops working. Details:
```D
import std.traits;
int foo(int num, string name, int);
static assert([ParameterIdentifierTuple!foo] == ["num", "name",
Does anybody recognize the error
```
Attribute 'nocapture' does not apply to function return values
%12 = call noalias nocapture align 8 ptr @_D3xxx(ptr nonnull
%10, { i64, ptr } %11) #2, !dbg !7978
Attribute 'nocapture' does not apply to function return values
ptr @_D3xyz1
Attribute
On Saturday, 30 March 2024 at 05:01:32 UTC, harakim wrote:
@D Language Foundation - This is a HUGE selling point. I had to
use cups the other day and I just copied some code from a d
file and linked the library. It was so easy I was suspicious
but it worked. Using C from D is pretty much as
On Saturday, 30 March 2024 at 03:25:02 UTC, matheus wrote:
Interesting!
Matheus.
Yes, it's just a small modification.
On Tuesday, 26 March 2024 at 20:42:00 UTC, Chris Piker wrote:
On Tuesday, 26 March 2024 at 20:19:27 UTC, bachmeier wrote:
Should be able to just use it, as described here:
https://forum.dlang.org/post/qxctappnigkwvaqak...@forum.dlang.org Create a .c file that includes the header files and
On Saturday, 30 March 2024 at 02:11:25 UTC, zjh wrote:
On Friday, 29 March 2024 at 22:50:53 UTC, curiousprogramma08
wrote:
you can use openD.
Wait a minute, they already added this modification into their
language?
Interesting!
Matheus.
On Friday, 29 March 2024 at 22:50:53 UTC, curiousprogramma08
wrote:
you can use openD.
On Friday, 29 March 2024 at 22:50:53 UTC, curiousprogramma08
wrote:
...
If I'm not mistaken, like in classes "private" is module based:
https://wiki.dlang.org/Access_specifiers_and_visibility
Matheus.
On Friday, March 29, 2024 4:50:53 PM MDT curiousprogramma08 via Digitalmars-d-
learn wrote:
> ```d
> struct QueueNode
> {
>
> private int data;
> private QueueNode *next = null;
>
> this(int data)
> {
> this.data = data;
> }
```d
struct QueueNode
{
private int data;
private QueueNode *next = null;
this(int data)
{
this.data = data;
}
}
```
I also tried to write it like this too:
```d
struct QueueNode
{
private:
int data;
QueueNode *next = null;
public:
this(int
On Friday, 29 March 2024 at 00:37:21 UTC, Jonathan M Davis wrote:
On Thursday, March 28, 2024 4:21:03 PM MDT Salih Dincer via
Digitalmars-d- learn wrote:
How can we add all members of an enum type to a list without
duplicating code?
As the documentation for EnumMembers explains, you can use
On Thu, Mar 28, 2024 at 11:49:19PM +, Liam McGillivray via
Digitalmars-d-learn wrote:
> On Thursday, 28 March 2024 at 04:46:27 UTC, H. S. Teoh wrote:
> > The whole point of a GC is that you leave everything up to it to
> > clean up. If you want to manage your own memory, d
On Friday, 29 March 2024 at 00:04:14 UTC, Serg Gini wrote:
On Thursday, 28 March 2024 at 23:15:26 UTC, Salih Dincer wrote:
There is no such thing as parallel programming in D anyway. At
least it has modules, but I didn't see it being works.
Whenever I use toys built in foreach() it always ends
On Thursday, March 28, 2024 4:21:03 PM MDT Salih Dincer via Digitalmars-d-
learn wrote:
> How can we add all members of an enum type to a list without
> duplicating code?
As the documentation for EnumMembers explains, you can use
std.meta.NoDuplicates to strip out duplicates if you want
On Thursday, 28 March 2024 at 23:15:26 UTC, Salih Dincer wrote:
There is no such thing as parallel programming in D anyway. At
least it has modules, but I didn't see it being works. Whenever
I use toys built in foreach() it always ends in disappointment
I think it just works :)
Which issues
On Thursday, 28 March 2024 at 04:46:27 UTC, H. S. Teoh wrote:
The whole point of a GC is that you leave everything up to it
to clean up. If you want to manage your own memory, don't use
the GC. D does not force you to use it; you can import
core.stdc.stdlib and use malloc/free to your heart's
On Thursday, 28 March 2024 at 23:08:54 UTC, rkompass wrote:
You can drop and take from the folded values range.
I got `[1, 0.67, 0.625, 0.619048, 0.618182, 0.618056,
0.618037, 0.618034, 0.618034, 0.618034]` from the above code.
Thank you so much...
I solved the problem: r.back doesn't
On Thursday, 28 March 2024 at 17:50:17 UTC, Salih Dincer wrote:
Hi,
When I use the chunks() template with iota(), for instance,
with chunks(2), I can access both r.front and r.back. However,
in a range of my own type (named iras in the code below), only
r.front is working. I think the error
On Thursday, 28 March 2024 at 20:18:10 UTC, rkompass wrote:
I didn't know that OpenMP programming could be that easy.
Binary size is 16K, same order of magnitude, although somewhat
less.
D advantage is gone here, I would say.
There is no such thing as parallel programming in D anyway. At
On Thursday, 28 March 2024 at 03:54:05 UTC, Salih Dincer wrote:
On Wednesday, 27 March 2024 at 20:50:05 UTC, rkompass wrote:
This works:
I decided to give the full code. Maybe then it will be better
understood what I mean. I actually pointed out the indirect
solution above but it's a bit
On Thu, Mar 28, 2024 at 10:10:43PM +, jms via Digitalmars-d-learn wrote:
> On Thursday, 28 March 2024 at 02:30:11 UTC, jms wrote:
[...]
> I think I figured it out and the difference is probably in the mode.
> This documentation
> https://learn.microsoft.com/en-us/cpp/c-run
On Thursday, 10 August 2023 at 08:33:13 UTC, Christian Köstlin
wrote:
I think one part of the original question (now fanished in the
nntp backup) was how to get all enum members into a list
without duplicating code.
```d
import std.traits : EnumMembers;
import std.stdio : writeln;
import
On Thursday, 28 March 2024 at 02:30:11 UTC, jms wrote:
Why in the below silly program am I reading both the \r and \n
characters when using rawRead in block a, but when looping by 1
byte chunks in block b only appear to be reading the \n
characters?
I'm on Windows 11 using DMD64 D Compiler
On Thursday, 28 March 2024 at 20:18:10 UTC, rkompass wrote:
D advantage is gone here, I would say.
It's hard to compare actually.
Std.parallelism has a bit different mechanics, and I think easier
to use. The syntax is nicer.
OpenMP is an well-known and highly adopted tool, which is also
On Thursday, 28 March 2024 at 14:07:43 UTC, Salih Dincer wrote:
On Thursday, 28 March 2024 at 11:50:38 UTC, rkompass wrote:
Turning back to this: Are there similarly simple libraries for
C, that allow for
parallel computation?
You can achieve parallelism in C using libraries such as
Hi,
When I use the chunks() template with iota(), for instance, with
chunks(2), I can access both r.front and r.back. However, in a
range of my own type (named iras in the code below), only r.front
is working. I think the error given by r.back is not a bug
related to chunks, is it?
```d
On Thu, Mar 28, 2024 at 05:23:39PM +, Andy Valencia via Digitalmars-d-learn
wrote:
[...]
> auto t = T();
> foreach (i, ref val; t.tupleof) {
> static if (is(typeof(val) == int)) {
> val = this.get_int();
> } else {
>
I wanted a lightweight and simpler CSV decoder. I won't post the
whole thing, but basically you instantiate one as:
struct Whatever {
...
}
...
f = File("path.csv", "r");
auto c = CSVreader!Whatever(f);
foreach (rec; c) { ...
CSVreader is, of course, templated:
struct
On Thursday, 28 March 2024 at 11:50:38 UTC, rkompass wrote:
Turning back to this: Are there similarly simple libraries for
C, that allow for
parallel computation?
You can achieve parallelism in C using libraries such as OpenMP,
which provides a set of compiler directives and runtime
On Thursday, 28 March 2024 at 01:09:34 UTC, Salih Dincer wrote:
Good thing you're digressing; I am 45 years old and I still
cannot say that I am finished as a student! For me this is
version 4 and it looks like we don't need a 3rd variable other
than the function parameter and return value:
On Thu, Mar 28, 2024 at 03:56:10AM +, Liam McGillivray via
Digitalmars-d-learn wrote:
[...]
> I may be now starting to see why the use of a garbage collector is
> such a point of contention for D. Not being able to predict how the
> garbage collection process will happen seems lik
On Wednesday, 27 March 2024 at 22:14:16 UTC, H. S. Teoh wrote:
What's the definition of this.map, this.faction, and
this.currentTile?
As was said, and can be found on the linked repository, they are
references to class objects.
On Thursday, 28 March 2024 at 01:47:27 UTC, Steven
On Wednesday, 27 March 2024 at 20:50:05 UTC, rkompass wrote:
This works:
I decided to give the full code. Maybe then it will be better
understood what I mean. I actually pointed out the indirect
solution above but it's a bit ugly and I'm sure there must be a
better way?
```d
import
Why in the below silly program am I reading both the \r and \n
characters when using rawRead in block a, but when looping by 1
byte chunks in block b only appear to be reading the \n
characters?
I'm on Windows 11 using DMD64 D Compiler v2.107.1 if that
matters, but I'm thinking this maybe
On Monday, 25 March 2024 at 07:16:35 UTC, Per Nordlöw wrote:
On Saturday, 23 March 2024 at 11:04:04 UTC, Dmitry Olshansky
wrote:
The first and second is unsound (infamously allowed in Java).
In the general case, yes. But, do you see any errors with the
code
```d
class Base {}
class Derived
On Wednesday, 27 March 2024 at 21:43:48 UTC, Liam McGillivray
wrote:
In my current [game
project](https://github.com/LiamM32/Open_Emblem), [something
strange](https://github.com/LiamM32/Open_Emblem/issues/20) has
happened as of a recent commit. When running `dub test`, all
the unittests
On Wednesday, 27 March 2024 at 08:22:42 UTC, rkompass wrote:
I apologize for digressing a little bit further - just to share
insights to other learners.
Good thing you're digressing; I am 45 years old and I still
cannot say that I am finished as a student! For me this is
version 4 and it
On Wed, Mar 27, 2024 at 09:43:48PM +, Liam McGillivray via
Digitalmars-d-learn wrote:
[...]
> ```
> ~this() {
> this.alive = false;
> if (this.map !is null) this.map.removeUnit(this);
> if (this.faction !is null) this.fac
In my current [game
project](https://github.com/LiamM32/Open_Emblem), [something
strange](https://github.com/LiamM32/Open_Emblem/issues/20) has
happened as of a recent commit. When running `dub test`, all the
unittests appear to pass, but then after the last unittest has
concluded an "Invalid
On Wednesday, 27 March 2024 at 13:38:29 UTC, Salih Dincer wrote:
So, not works this:
```d
fib(1, 1).take(48)
//.array
.chunks(2)
.map!"a[1] / a[0]"
.back
.writeln; // 1.61803
```
Thanks...
SDB@79
This works:
```d
import std.stdio;
import
Is it possible to process both chunks without requiring memory
allocation (not using an array)?
For example:
```d
import std;
void main()
{
auto fib = (real a, real b)
=> recurrence!"a[n-1] + a[n-2]"(a, b);
auto myFib = fib(1, 1).take(48).array;
auto goldenRadio =
I apologize for digressing a little bit further - just to share
insights to other learners.
I had the question, why my binary was so big (> 4M), discovered
the
`gdc -Wall -O2 -frelease -shared-libphobos` options (now >200K).
Then I tried to avoid GC, just learnt about this: The GC in the
On 3/26/24 8:44 PM, Andrea Fontana wrote:
On Tuesday, 26 March 2024 at 07:13:24 UTC, confuzzled wrote:
I think you should use the HTTP interface, did you check this docs?
https://dlang.org/phobos/std_net_curl.html#.HTTP
https://dlang.org/phobos/std_net_curl.html#.HTTP.addRequestHeader
Andrea
On Tuesday, 26 March 2024 at 20:42:00 UTC, Chris Piker wrote:
On Tuesday, 26 March 2024 at 20:19:27 UTC, bachmeier wrote:
Should be able to just use it, as described here:
https://forum.dlang.org/post/qxctappnigkwvaqak...@forum.dlang.org Create a .c file that includes the header files and
On Tuesday, 26 March 2024 at 20:19:27 UTC, bachmeier wrote:
Should be able to just use it, as described here:
https://forum.dlang.org/post/qxctappnigkwvaqak...@forum.dlang.org Create a .c file that includes the header files and then call the functions you need.
Wow. **That just worked the
On Tuesday, 26 March 2024 at 19:24:39 UTC, Chris Piker wrote:
Hi D
I have a C library I use for work, it's maintained by an
external organization that puts it through a very through test
framework. Though source code is supplied, the intended use is
to include the header files and link
Hi D
I have a C library I use for work, it's maintained by an external
organization that puts it through a very through test framework.
Though source code is supplied, the intended use is to include
the header files and link against pre-compiled code.
What is the best way, as of 2024 to
On Thursday, 7 March 2024 at 00:38:30 UTC, Richard (Rikki) Andrew
Cattermole wrote:
Yes its opt-in.
https://dlang.org/spec/statement.html#synchronized-statement
As you mentioned in another thread there's handy ABI
documentation for classes and interfaces just here
On Tuesday, 26 March 2024 at 14:25:53 UTC, Lance Bachmeier wrote:
On Sunday, 24 March 2024 at 19:31:19 UTC, Csaba wrote:
I know that benchmarks are always controversial and depend on
a lot of factors. So far, I read that D performs very well in
benchmarks, as well, if not better, as C.
I
On Sunday, 24 March 2024 at 19:31:19 UTC, Csaba wrote:
I know that benchmarks are always controversial and depend on a
lot of factors. So far, I read that D performs very well in
benchmarks, as well, if not better, as C.
I wrote a little program that approximates PI using the Leibniz
On Monday, 25 March 2024 at 14:02:08 UTC, rkompass wrote:
Of course you may also combine the up(+) and down(-) step to
one:
1/i - 1/(i+2) = 2/(i*(i+2))
```d
double leibniz(int iter) {
double n = 0.0;
for (int i = 1; i < iter; i+=4)
n += 2.0 / (i * (i+2.0));
return n * 4.0;
}
```
On Sunday, 24 March 2024 at 21:21:13 UTC, kdevel wrote:
Usually you do not translate mathematical expressions directly
into code:
```
n += pow(-1.0, i - 1.0) / (i * 2.0 - 1.0);
```
The term containing the `pow` invocation computes the
alternating sequence -1, 1, -1, ..., which can be
On Tuesday, 26 March 2024 at 07:13:24 UTC, confuzzled wrote:
Hello all,
I have two scripts. I copied the first directly from the alpaca
website and massaged it with etc.c.curl until it compiled in D.
The result is that it creates the order and returns the result
to stdout. In the second
Hello all,
I have two scripts. I copied the first directly from the alpaca
website and massaged it with etc.c.curl until it compiled in D.
The result is that it creates the order and returns the result to
stdout. In the second script, I tried to use std.net.curl but
cannot get it to work.
On Saturday, 23 March 2024 at 22:37:06 UTC, Liam McGillivray
wrote:
...a tick system would go hand-in-hand with making animations
happen in a separate thread, but it sounds like you're talking
about the same thread. Are you suggesting a fixed framerate?
I have done both ways. If you're new to
On Thursday, 14 March 2024 at 18:49:54 UTC, Dejan Lekic wrote:
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
Unfortunately there's no "edit" option here, but the library I
was referring to is actually "libdparse".
On Thursday, 7 March 2024 at 22:18:40 UTC, Richard (Rikki) Andrew
Cattermole wrote:
There are two ways to do this.
1. Use templates.
https://tour.dlang.org/tour/en/basics/templates
Thank you for teaching me how to do this. This is where I first
learned to use templates in D, and I have been
On Sunday, 24 March 2024 at 23:02:19 UTC, Sergey wrote:
On Sunday, 24 March 2024 at 22:16:06 UTC, rkompass wrote:
Are there some simple switches / settings to get a smaller
binary?
1) If possible you can use "betterC" - to disable runtime
2) otherwise
```bash
--release --O3 --flto=full
On Saturday, 23 March 2024 at 11:04:04 UTC, Dmitry Olshansky
wrote:
The first and second is unsound (infamously allowed in Java).
In the general case, yes. But, do you see any errors with the code
```d
class Base {}
class Derived : Base {}
@safe pure nothrow unittest {
Base b;
On Sunday, 24 March 2024 at 22:16:06 UTC, Kdevel wrote:
The term containing the `pow` invocation computes the
alternating sequence -1, 1, -1, ..., which can be replaced by
e.g.
```d
immutable int [2] sign = [-1, 1];
n += sign [i & 1] / (i * 2.0 - 1.0);
```
This saves the expensive call
On Sunday, 24 March 2024 at 22:16:06 UTC, rkompass wrote:
Are there some simple switches / settings to get a smaller
binary?
1) If possible you can use "betterC" - to disable runtime
2) otherwise
```bash
--release --O3 --flto=full -fvisibility=hidden
The term containing the `pow` invocation computes the
alternating sequence -1, 1, -1, ..., which can be replaced by
e.g.
```
immutable int [2] sign = [-1, 1];
n += sign [i & 1] / (i * 2.0 - 1.0);
```
This saves the expensive call to the pow function.
I used the loop:
```d
for
On Saturday, 23 March 2024 at 04:32:29 UTC, harakim wrote:
* You should probably not do this, but it might give you some
ideas for later. What I would do is make a separate thread for
managing the UI state and push events to that thread through
the mailbox. I have done this once (on my third
On Sunday, 24 March 2024 at 19:31:19 UTC, Csaba wrote:
I know that benchmarks are always controversial and depend on a
lot of factors. So far, I read that D performs very well in
benchmarks, as well, if not better, as C.
I wrote a little program that approximates PI using the Leibniz
On Sunday, 24 March 2024 at 19:31:19 UTC, Csaba wrote:
As you can see the function that does the job is exactly the
same in C and D.
Not really..
The speed of Leibniz algo is mostly the same. You can check the
code in this benchmark for example:
On Sunday, 24 March 2024 at 19:31:19 UTC, Csaba wrote:
...
Here are the results:
C: 0.04s
Python: 0.33s
D: 0.73s
...
I think a few things can be going on, but one way to go is trying
using optimization flags like "-O2", and run again.
But anyway, looking through Assembly generated:
C:
301 - 400 of 76595 matches
Mail list logo