On Sunday, 10 April 2022 at 23:19:47 UTC, rikki cattermole wrote:
immutable isn't tied to lifetime semantics.
It only says that this memory will never be modified by anyone
during its lifetime.
This is clearly where I am misunderstanding. In my mind immutable
data means the data will not ch
Hi All,
I am clearly misunderstanding something fundamental, and probably
obvious :D
Reading some of the discussions on __metadata I was wondering if
someone could explain why a immutable reference counting type is
needed. By definition a reference counter cannot be immutable, so
what would
On Thursday, 5 August 2021 at 01:14:26 UTC, H. S. Teoh wrote:
On Thu, Aug 05, 2021 at 12:47:06AM +, someone via
Digitalmars-d-learn wrote:
[...]
1) If the constant is a POD (int, float, etc.), use:
enum myValue = ...;
2) If the constant is a string or some other array:
s
On Monday, 8 March 2021 at 22:29:58 UTC, Q. Schroll wrote:
When I enter `dmd --version`, it says:
DMD64 D Compiler v2.095.1-dirty
What should the "dirty" mean? To me, it seems looks something
went wrong somewhere.
This comes from `git describe --dirty` and indicates there were
uncommitted c
On Friday, 20 November 2020 at 18:46:40 UTC, Martin wrote:
On Friday, 20 November 2020 at 10:03:18 UTC, Daniel Kozak wrote:
I remember days when I liked UFCS too . Unfortunately it is
not so awesome when you use it with IDE.
And I would like to add: if you use in a bigger team. It's
annoying
I was reading some posts and this was presented as a snippet of
code and was immediately flagged as bad practice.
I get some people don't like it but occasionally I prefer this
syntax. It feels more declarative and fluent in style. Is there a
good technical reason why it is bad practice, e.g.
On Friday, 1 May 2020 at 07:38:53 UTC, Chris Katko wrote:
I'm making anagrams. According to the nextPermutation() docs, I
need to 'sort by less' to get all permutations. ... Except the
doc page doesn't mention how to do that, nor does
std.algorithm.sort show how to sort a string. ... and the
g
On Saturday, 1 February 2020 at 08:38:22 UTC, Luhrel wrote:
On Saturday, 1 February 2020 at 08:32:51 UTC, Ferhat Kurtulmuş
wrote:
On Saturday, 1 February 2020 at 08:27:07 UTC, Luhrel wrote:
On Saturday, 1 February 2020 at 08:21:29 UTC, Ferhat
Kurtulmuş wrote:
You cannot.
https://dlang.org/sp
On Thursday, 19 September 2019 at 20:47:45 UTC, Shadowblitz16
wrote:
On Thursday, 19 September 2019 at 19:16:03 UTC, Mike Parker
wrote:
On Thursday, 19 September 2019 at 18:25:05 UTC, Shadowblitz16
wrote:
I wanted to do 4bpp 16 color graphics.
and I didn't want to load anything unnecessary in
On Wednesday, 18 September 2019 at 11:10:11 UTC, berni wrote:
Is it possible to simplfy this?
static if (is (T==Complex!double) || is (T==Complex!float) ||
is (T==Complex!real))
I usually do something like the following:
---
import std.traits;
template isComplexReal(T) {
enum isComplexRe
On Thursday, 12 September 2019 at 12:52:48 UTC, BoQsc wrote:
Is there a way to archive multiple .d source code files and
make that archive executable, or something similar?
You can achieve something similar with rdmd and shell;
$ tar -zcvf source_files.tar.gz source1.d source2.d ... sourceN.d
On Monday, 17 June 2019 at 00:22:23 UTC, Samir wrote:
On Sunday, 16 June 2019 at 23:55:41 UTC, lithium iodate wrote:
There is *very* likely to be a terminating new-line at the end
of the file (many editors add one without asking!). If that
the case, the last line seen by the loop will be empty
On Thursday, 7 February 2019 at 07:44:17 UTC, Alex wrote:
On Thursday, 7 February 2019 at 07:33:50 UTC, Norm wrote:
[...]
Hmm... found something similar from 2014...
https://issues.dlang.org/show_bug.cgi?id=11864
Thanks, I've added a comment to that bug report.
Cheers,
Norm
Hi,
I'm trying to use Variant in a struct and want a default init
value like so:
---
struct S {
Variant v = Variant(10);
}
void main() {auto s = S();}
but when I try to build this I get the following error:
dmd2/linux/bin64/../../src/phobos/std/variant.d(661): Error:
memcpy cannot be inte
On Saturday, 2 February 2019 at 16:56:45 UTC, Ron Tarrant wrote:
Hi guys,
I ran into another snag this morning while trying to implement
a singleton. I found all kinds of examples of singleton
definitions, but nothing about how to put them into practice.
Can someone show me a code example fo
On Saturday, 2 February 2019 at 16:56:45 UTC, Ron Tarrant wrote:
Hi guys,
I ran into another snag this morning while trying to implement
a singleton. I found all kinds of examples of singleton
definitions, but nothing about how to put them into practice.
[...]
If you haven't already been t
On Friday, 16 November 2018 at 15:59:14 UTC, Vinay Sajip wrote:
This code should IMO give at least a warning, but it doesn't:
abstract class A {
int kind;
}
[...]
This is not unique to D you can do the same in Java or C++.
bye,
Norm
On Thursday, 13 September 2018 at 23:25:24 UTC, Josphe Brigmo
wrote:
I am trying to remove a file
remove(filename);
and I get an access denied!
I can remove it from explorer just fine.
I am able to remove other files but there should be no reason
why the file can't be removed in this case.
On Sunday, 1 April 2018 at 15:54:16 UTC, Steven Schveighoffer
wrote:
I currently have a situation where I want to have a function
that accepts a parameter optionally.
I thought maybe Nullable!int might work:
void foo(Nullable!int) {}
void main()
{
foo(1); // error
int x;
foo(x); // e
On Thursday, 29 March 2018 at 04:16:55 UTC, Adam D. Ruppe wrote:
On Thursday, 29 March 2018 at 04:12:38 UTC, Norm wrote:
Is there a way to do this in D, or does it require special
"create" functions for every struct that has a RAII-like
struct as a member?
You'll have to do it all the way up
On Tuesday, 27 March 2018 at 02:43:15 UTC, Adam D. Ruppe wrote:
On Tuesday, 27 March 2018 at 02:35:23 UTC, Norm wrote:
What's the best way to do this in D?
I'd also add `@disable this();` and then a `static O make() {
return O(theAllocator.make!int(99)); }`
than you construct it with that s
On Tuesday, 27 March 2018 at 02:43:15 UTC, Adam D. Ruppe wrote:
On Tuesday, 27 March 2018 at 02:35:23 UTC, Norm wrote:
What's the best way to do this in D?
I'd also add `@disable this();` and then a `static O make() {
return O(theAllocator.make!int(99)); }`
than you construct it with that s
Hi All,
What's the best way to do this in D?
E.g.
---
struct O
{
int* value;
@disable this(this);
/+
this()
{
this.value = theAllocator.make!int(99);
}
+/
~this()
{
theAllocator.dispose(this.value);
}
}
O obj = O(); // Ideally this would be allocated but it simply run
On Friday, 23 February 2018 at 01:54:07 UTC, Leonardo wrote:
Hi, I'm new to language and games.
Many people say that GC is bad and can slow down your project
in some moments.
What can happen if I create a game using D without worrying
with memory management?
(using full GC)
Have a look at ht
Hi,
I'm new to D so can someone explain to me what is happening here?
void func(const char* s, char** e) {
import core.stdc.stdlib;
auto result = strtod(s, e);
}
Error: function core.stdc.stdlib.strtod (scope inout(char)* nptr,
scope inout(char)** endptr) is not callable using argumen
Hi All,
In my generic code I now get this error, which requires manually
finding all -a[] array ops, but that is another matter.
$/src/druntime/import/core/internal/arrayop.d-mixin-57(57,20):
Deprecation: integral promotion not done for -_param_1[pos], use
'-transition=intpromote' switch or
26 matches
Mail list logo