On Monday, 5 December 2022 at 14:48:33 UTC, cc wrote:
On Sunday, 4 December 2022 at 09:53:41 UTC, vushu wrote:
[...]
If your program runs, does some stuff, and terminates, use the
GC.
If your program runs, stays up for a while with user
occasionally interacting with it, use the GC.
If your
On Sunday, 4 December 2022 at 17:47:38 UTC, ryuukk_ wrote:
On Sunday, 4 December 2022 at 09:53:41 UTC, vushu wrote:
[...]
D gives you the choice
But the most important thing is your usecase, what kind of
library are you making?
Once you answer this question, you can then ask what your
On Monday, 5 December 2022 at 10:53:33 UTC, Guillaume Piolat
wrote:
On Sunday, 4 December 2022 at 21:55:52 UTC, Siarhei Siamashka
wrote:
Is it possible to filter packages in this list by @nogc or
@safe compatibility?
You can list DUB packages for "@nogc usage"
On Monday, 5 December 2022 at 10:48:59 UTC, Guillaume Piolat
wrote:
There are legitimate uses cases when you can't afford the
runtime machinery (attach/detach every incoming thread in a
shared library), more than not being able to afford the GC from
a performance point of view.
[...]
On Sunday, 4 December 2022 at 23:25:34 UTC, Adam D Ruppe wrote:
On Sunday, 4 December 2022 at 22:46:52 UTC, Ali Çehreli wrote:
That's way beyond my pay grade. Explain please. :)
The reason that the GC stops threads right now is to ensure
that something doesn't change in the middle of its
On Sunday, 4 December 2022 at 09:53:41 UTC, vushu wrote:
What are your thoughts about using GC as a library writer?
If your program runs, does some stuff, and terminates, use the GC.
If your program runs, stays up for a while with user occasionally
interacting with it, use the GC.
If your
On Sunday, 4 December 2022 at 21:55:52 UTC, Siarhei Siamashka
wrote:
Is it possible to filter packages in this list by @nogc or
@safe compatibility?
You can list DUB packages for "@nogc usage"
https://code.dlang.org/?sort=score=20=library.nogc
There are legitimate uses cases when you can't afford the runtime
machinery (attach/detach every incoming thread in a shared
library), more than not being able to afford the GC from a
performance point of view.
GC gives you higher productivity and better performance with the
time gained.
On Sunday, 4 December 2022 at 23:37:39 UTC, Ali Çehreli wrote:
On 12/4/22 15:25, Adam D Ruppe wrote:
> which would trigger the write barrier. The thread isn't
> allowed to complete this operation until the GC is done.
According to my limited understanding of write barriers, the
thread moving
On 12/4/22 15:25, Adam D Ruppe wrote:
> which would trigger the write barrier. The thread isn't
> allowed to complete this operation until the GC is done.
According to my limited understanding of write barriers, the thread
moving to 800 could continue because order of memory operations may
On Sunday, 4 December 2022 at 22:46:52 UTC, Ali Çehreli wrote:
That's way beyond my pay grade. Explain please. :)
The reason that the GC stops threads right now is to ensure that
something doesn't change in the middle of its analysis.
Consider for example, the GC scans address 0 - 1000 and
ALl it means is certain memory patterns (such as writes), will tell the
GC about it.
Its required for pretty much all advanced GC designs, as a result we are
pretty much maxing out what we can do.
Worth reading:
On 12/4/22 12:17, Adam D Ruppe wrote:
On Sunday, 4 December 2022 at 17:53:00 UTC, Adam D Ruppe wrote:
Interesting... you know, maybe D's GC should formally expose a mutex
that you can synchronize on for when it is running.
.. or compile in write barriers. then it doesn't matter if the
On Sunday, 4 December 2022 at 21:55:52 UTC, Siarhei Siamashka
wrote:
Do you mean the top of the
https://code.dlang.org/?sort=score=library list?
Well, I was referring to the five that appear on the homepage,
which shows silly instead of emsi containers.
How do you know that they embrace
On Sunday, 4 December 2022 at 12:37:08 UTC, Adam D Ruppe wrote:
All of the top 5 most popular libraries on code.dlang.org
embrace the GC.
Do you mean the top of the
https://code.dlang.org/?sort=score=library list?
How do you know that they embrace GC? Is it possible to filter
packages in
On Sunday, 4 December 2022 at 17:53:00 UTC, Adam D Ruppe wrote:
Interesting... you know, maybe D's GC should formally expose a
mutex that you can synchronize on for when it is running.
.. or compile in write barriers. then it doesn't matter
if the thread is unregistered, the write
On Sunday, 4 December 2022 at 16:02:28 UTC, Ali Çehreli wrote:
D's GC needed to stop the world, which meant it would have to
know what threads were running. You can never be sure whether
your D library function is being called from a thread you've
known or whether the Java runtime (or other
On Sunday, 4 December 2022 at 09:53:41 UTC, vushu wrote:
Dear dlang community.
I am unsure about what idiomatic D is.
Some of the Dconf talks tells people just to use the GC, until
you can't afford
it.
If there are documents that describes what idiomatic D is then
I would appreciate
On Sunday, 4 December 2022 at 15:57:26 UTC, Ali Çehreli wrote:
On 12/4/22 05:58, vushu wrote:
> I was worried if my library should be GC free
May I humbly recommend you question where that thinking comes
from?
Ali
P.S. I used to be certain that the idea of GC was wrong and the
creators of
On 12/4/22 06:27, Sergey wrote:
> if it will be possible to write
> library in D and use it from
> C/++/Python/R/JVM(JNI)/Erlang(NIF)/nameYourChoice smoothly it will be a
> win.
Years ago we tried to call D from Java. I realized that it was very
tricky to introduce the calling thread to D's
On 12/4/22 05:58, vushu wrote:
> I was worried if my library should be GC free
May I humbly recommend you question where that thinking comes from?
Ali
P.S. I used to be certain that the idea of GC was wrong and the creators
of runtimes with GC were simpletons. In contrast, people like me,
On Sunday, 4 December 2022 at 12:37:08 UTC, Adam D Ruppe wrote:
All of the top 5 most popular libraries on code.dlang.org
embrace the GC.
Interesting. It seems that most of the community suppose that
“library” should be used from D :-)
But in my opinion - “foreign library experience” is much
On Sunday, 4 December 2022 at 13:03:07 UTC, Hipreme wrote:
On Sunday, 4 December 2022 at 09:53:41 UTC, vushu wrote:
Dear dlang community.
I am unsure about what idiomatic D is.
Some of the Dconf talks tells people just to use the GC, until
you can't afford
it.
If there are documents
On Sunday, 4 December 2022 at 12:37:08 UTC, Adam D Ruppe wrote:
On Sunday, 4 December 2022 at 09:53:41 UTC, vushu wrote:
What are your thoughts about using GC as a library writer?
Do it. It is lots of gain for very little loss.
If you wan't to include a library into your project aren't you
On Sunday, 4 December 2022 at 09:53:41 UTC, vushu wrote:
Dear dlang community.
I am unsure about what idiomatic D is.
Idiomatic D code produces the correct result, it's readable, and
it's easy for others to use.
Some of the Dconf talks tells people just to use the GC, until
you can't
On Sunday, 4 December 2022 at 09:53:41 UTC, vushu wrote:
Dear dlang community.
I am unsure about what idiomatic D is.
Some of the Dconf talks tells people just to use the GC, until
you can't afford
it.
If there are documents that describes what idiomatic D is then
I would appreciate
On Sunday, 4 December 2022 at 09:53:41 UTC, vushu wrote:
What are your thoughts about using GC as a library writer?
Do it. It is lots of gain for very little loss.
If you wan't to include a library into your project aren't you
more inclined to use a library which is gc free?
No, GC free
Dear dlang community.
I am unsure about what idiomatic D is.
Some of the Dconf talks tells people just to use the GC, until
you can't afford
it.
If there are documents that describes what idiomatic D is then I
would appreciate it.
So my questions are:
What are your thoughts about
On Monday, 3 August 2020 at 15:33:54 UTC, Dominikus Dittes
Scherkl wrote:
[...]
For really long expressions you could also split it on multiple
lines:
c = (b_expression == 0)
? (d_longer_expression)
: (a_expression/b_expression);
+1 looks clean!
On Monday, 3 August 2020 at 14:50:36 UTC, Steven Schveighoffer
wrote:
On 8/3/20 5:53 AM, Martin Tschierschke wrote:
I prefer putting additional bracket around
For really long expressions you could also split it on multiple
lines:
c = (b_expression == 0)
? (d_longer_expression)
:
On 8/3/20 5:53 AM, Martin Tschierschke wrote:
On Friday, 31 July 2020 at 14:18:15 UTC, Steven Schveighoffer wrote:
On 7/31/20 9:55 AM, Martin Tschierschke wrote:
What would be the idiomatic way to write a floating point division
occuring inside a loop and handle the case of division by zero.
On Friday, 31 July 2020 at 14:18:15 UTC, Steven Schveighoffer
wrote:
On 7/31/20 9:55 AM, Martin Tschierschke wrote:
What would be the idiomatic way to write a floating point
division
occuring inside a loop and handle the case of division by zero.
c = a/b; // b might be zero sometimes, than
On Friday, 31 July 2020 at 15:19:25 UTC, Andrea Fontana wrote:
On Friday, 31 July 2020 at 13:55:18 UTC, Martin Tschierschke
wrote:
What would be the idiomatic way to write a floating point
division
occuring inside a loop and handle the case of division by zero.
c = a/b; // b might be zero
On Friday, 31 July 2020 at 13:55:18 UTC, Martin Tschierschke
wrote:
What would be the idiomatic way to write a floating point
division
occuring inside a loop and handle the case of division by zero.
c = a/b; // b might be zero sometimes, than set c to an other
value (d).
(In the moment I
On 7/31/20 9:55 AM, Martin Tschierschke wrote:
What would be the idiomatic way to write a floating point division
occuring inside a loop and handle the case of division by zero.
c = a/b; // b might be zero sometimes, than set c to an other value (d).
(In the moment I check the divisor being
What would be the idiomatic way to write a floating point division
occuring inside a loop and handle the case of division by zero.
c = a/b; // b might be zero sometimes, than set c to an other
value (d).
(In the moment I check the divisor being zero or not, with an
if-than-else structure,
On Monday, 8 January 2018 at 23:03:46 UTC, H. S. Teoh wrote:
On Mon, Jan 08, 2018 at 10:59:44PM +, aliak via
Digitalmars-d-learn wrote: [...]
onlineapp.d(61): Error: template std.traits.TemplateOf does
not match any template declaration. And I use it like this:
enum r1Sorted =
On Monday, 8 January 2018 at 23:22:04 UTC, Seb wrote:
On Monday, 8 January 2018 at 23:14:32 UTC, Seb wrote:
Your problem is that `TemplateOf!(int[])` isn't defined. It
should probably be changed to return `void`.
https://github.com/dlang/phobos/pull/6016
Damn that's some fast turnaround!
On Monday, 8 January 2018 at 23:14:32 UTC, Seb wrote:
Your problem is that `TemplateOf!(int[])` isn't defined. It
should probably be changed to return `void`.
https://github.com/dlang/phobos/pull/6016
On Mon, Jan 08, 2018 at 10:59:44PM +, aliak via Digitalmars-d-learn wrote:
[...]
> onlineapp.d(61): Error: template std.traits.TemplateOf does not match
> any template declaration. And I use it like this:
>
> enum r1Sorted = __traits(isSame, TemplateOf!(R1), SortedRange);
This seems
On Monday, 8 January 2018 at 22:59:44 UTC, aliak wrote:
Hi, trying to write some idiomatic generic D code and I'm a bit
stuck with using the TemplateOf to check if a range is a
SortedRange or not. A bit about the code, I'm basically
rewriting
Hi, trying to write some idiomatic generic D code and I'm a bit
stuck with using the TemplateOf to check if a range is a
SortedRange or not. A bit about the code, I'm basically rewriting
https://dlang.org/library/std/algorithm/setops/set_difference.html but I want to do different things based
On Tuesday, 13 January 2015 at 17:41:53 UTC, Tobias Pankrath
wrote:
On Tuesday, 13 January 2015 at 17:19:42 UTC, Laeeth Isharc
wrote:
The GC is allowed to move structs around, as I undestand it.
Under what circumstances do I get into trouble having a
pointer to them?
None, a GC that moves
(( It follows from this that it will be challenging to achieve
full memory safety without fixing the type system first. ))
On Wed, Jan 14, 2015 at 07:05:16PM +, Laeeth Isharc via Digitalmars-d-learn
wrote:
On Tuesday, 13 January 2015 at 17:41:53 UTC, Tobias Pankrath wrote:
On Tuesday, 13 January 2015 at 17:19:42 UTC, Laeeth Isharc wrote:
The GC is allowed to move structs around, as I undestand it. Under
On Wed, Jan 14, 2015 at 07:43:17PM +, via Digitalmars-d-learn wrote:
On Wednesday, 14 January 2015 at 19:36:44 UTC, H. S. Teoh via
Digitalmars-d-learn wrote:
Moral of the story: don't have struct fields that point to the struct
itself. This is almost always a bad idea. Structs have value
On Wednesday, 14 January 2015 at 19:36:44 UTC, H. S. Teoh via
Digitalmars-d-learn wrote:
Moral of the story: don't have struct fields that point to the
struct
itself. This is almost always a bad idea. Structs have value
semantics,
and the implicit copying around will almost certainly break any
On Wednesday, 14 January 2015 at 20:23:26 UTC, H. S. Teoh via
Digitalmars-d-learn wrote:
Huh? ints have value semantics, yet you can take the address of
a local
int variable. What's your point?
Strictly speaking the int looses its value semantics if you
take the address of it, hold it and
On Wednesday, 7 January 2015 at 14:59:58 UTC, H. S. Teoh via
Digitalmars-d-learn wrote:
On Wed, Jan 07, 2015 at 02:52:51PM +, Laeeth Isharc via
Digitalmars-d-learn wrote:
Another schoolboy question.
Suppose I am constructing a tree (in this case it is an AST).
In C I
would have a pointer
On Tuesday, 13 January 2015 at 17:19:42 UTC, Laeeth Isharc wrote:
The GC is allowed to move structs around, as I undestand it.
Under what circumstances do I get into trouble having a pointer
to them?
None, a GC that moves structs around must update every pointer
afterwards and as far as I
Small recommendation (apart from the reserved word issue which
you fixed): it's generally considered good D style to give
structs and classes names that start with capital letters,
JustLikeThis. So, I suggest Node rather than node.
Very minor point, and of course, your code is yours to style
On 07/01/15 16:02, Laeeth Isharc via Digitalmars-d-learn wrote:
class node
{
string name;
node ref;
}
Small recommendation (apart from the reserved word issue which you fixed): it's
generally considered good D style to give structs and classes names that start
with capital letters,
this conversation is so funny: well what's wrong with this .
It's a keyword...
Aa Ha ha ha ha , rol.
Seriously, is it so complicated to use a D editor ? I mean with
syntax color...
Man afraid to ask stoopid questions stays stoopid. And compiler
error message far from informative.
Not
On Thursday, 8 January 2015 at 11:29:30 UTC, Laeeth Isharc wrote:
this conversation is so funny: well what's wrong with this .
It's a keyword...
Aa Ha ha ha ha , rol.
Seriously, is it so complicated to use a D editor ? I mean
with syntax color...
Man afraid to ask stoopid questions stays
what's wrong with the code above ? i get an error no
identifier for declarator node. (I have not used classes
much, since structs often seem to be enough for what I need
to do mostly).
ref is a reserved keyword.
--
Paulo
this conversation is so funny: well what's wrong with this .
On Thu, Jan 08, 2015 at 11:29:29AM +, Laeeth Isharc via Digitalmars-d-learn
wrote:
this conversation is so funny: well what's wrong with this . It's a
keyword...
Aa Ha ha ha ha , rol.
Seriously, is it so complicated to use a D editor ? I mean with
syntax color...
Man afraid to ask
On 1/8/15 12:15 AM, Meta wrote:
On Wednesday, 7 January 2015 at 23:27:19 UTC, anonymous wrote:
Don't do this without `dup`ing. Quoting the documentation:
Oh, whoops. I thought those special variadic args were always allocated
on the heap.
Nope,
Which makes it annoying, what if the argument
On 01/08/2015 09:40 AM, H. S. Teoh via Digitalmars-d-learn wrote:
Vim supports syntax highlighting.
But I don't use it either -- I find it distracts from clarity of
thought. I use plain vanilla vim in a text-only terminal.
I am halfway there: I use syntax highlighting in Emacs but I chose
On Thursday, 8 January 2015 at 17:42:23 UTC, H. S. Teoh via
Digitalmars-d-learn wrote:
On Thu, Jan 08, 2015 at 11:29:29AM +, Laeeth Isharc via
Digitalmars-d-learn wrote:
this conversation is so funny: well what's wrong with this .
It's a
keyword...
Aa Ha ha ha ha , rol.
Seriously, is it
On Thu, Jan 08, 2015 at 07:13:28PM +, Paulo Pinto via Digitalmars-d-learn
wrote:
On Thursday, 8 January 2015 at 17:42:23 UTC, H. S. Teoh via
Digitalmars-d-learn wrote:
[...]
Vim supports syntax highlighting.
But I don't use it either -- I find it distracts from clarity of
thought. I
On Wednesday, 7 January 2015 at 15:04:24 UTC, Paulo Pinto wrote:
On Wednesday, 7 January 2015 at 15:02:34 UTC, Laeeth Isharc
wrote:
Not true. If you're using a tree structure, you *should* use
pointers.
Unless you're using classes, which are by-reference, in which
case you
can just use the
On Wednesday, 7 January 2015 at 23:27:19 UTC, anonymous wrote:
Don't do this without `dup`ing. Quoting the documentation:
Oh, whoops. I thought those special variadic args were always
allocated on the heap.
On Wednesday, 7 January 2015 at 20:25:10 UTC, Meta wrote:
struct Tree
{
this(string data, Tree[] children...)
{
this.data = data;
this.children = children;
Don't do this without `dup`ing. Quoting the documentation:
An implementation may construct the object or array
On Wednesday, 7 January 2015 at 16:17:47 UTC, Tobias Pankrath
wrote:
A slice seems overkill to refer to just one object, but is that
the best way ?
struct Tree
{
Tree[] children;
}
Is one way to do it.
You can add some nice sugar for this as well:
struct Tree
{
this(string data,
ref is a reserved keyword.
doh!
Thanks.
Another schoolboy question.
Suppose I am constructing a tree (in this case it is an AST). In
C I would have a pointer for the child to find the parent, and an
array or linked list of pointers to find the children from the
parent.
Obviously, I could still use pointers, but that would not be
A slice seems overkill to refer to just one object, but is that
the best way ?
struct Tree
{
Tree[] children;
}
Is one way to do it.
On Wed, Jan 07, 2015 at 02:52:51PM +, Laeeth Isharc via Digitalmars-d-learn
wrote:
Another schoolboy question.
Suppose I am constructing a tree (in this case it is an AST). In C I
would have a pointer for the child to find the parent, and an array or
linked list of pointers to find the
Not true. If you're using a tree structure, you *should* use
pointers.
Unless you're using classes, which are by-reference, in which
case you
can just use the class as-is. :-)
Thanks v much.
I just came to that realization also when I stepped away.
class node
{
string name;
On Wednesday, 7 January 2015 at 15:02:34 UTC, Laeeth Isharc wrote:
Not true. If you're using a tree structure, you *should* use
pointers.
Unless you're using classes, which are by-reference, in which
case you
can just use the class as-is. :-)
Thanks v much.
I just came to that realization
kind of things
should some one think about if they are trying to do
idiomatic D?
There is no official idiomatic style like, for example, in
python. When I speak about idiomatic D I usually think about
style Phobos is written in (omitting legacy modules) as it is
the code that gets most
On Thursday, 30 January 2014 at 22:40:24 UTC, Tofu Ninja wrote:
There is no official idiomatic style like, for example, in
python. When I speak about idiomatic D I usually think about
style Phobos is written in (omitting legacy modules) as it is
the code that gets most attention from most
On Thursday, 30 January 2014 at 20:05:11 UTC, Tofu Ninja wrote:
I hear it thrown around a lot but what does it actually mean?
What does the ideal D code look like? What kind of things
should some one think about if they are trying to do idiomatic
D?
There is no official idiomatic style like
I hear it thrown around a lot but what does it actually mean?
What does the ideal D code look like? What kind of things should
some one think about if they are trying to do idiomatic D?
to do idiomatic
D?
There is no official idiomatic style like, for example, in
python. When I speak about idiomatic D I usually think about
style Phobos is written in (omitting legacy modules) as it is
the code that gets most attention from most experienced D
developers.
Got any tips?
On Friday, 31 January 2014 at 00:08:02 UTC, Meta wrote:
On Thursday, 30 January 2014 at 22:40:24 UTC, Tofu Ninja wrote:
Got any tips?
Ranges, templates and structs.
~= CTFE ~ UFCS
kind of things
should some one think about if they are trying to do
idiomatic D?
There is no official idiomatic style like, for example, in
python. When I speak about idiomatic D I usually think about
style Phobos is written in (omitting legacy modules) as it is
the code that gets most
On Friday, 31 January 2014 at 00:09:34 UTC, Stanislav Blinov
wrote:
On Friday, 31 January 2014 at 00:08:02 UTC, Meta wrote:
On Thursday, 30 January 2014 at 22:40:24 UTC, Tofu Ninja wrote:
Got any tips?
Ranges, templates and structs.
~= CTFE ~ UFCS
~= std.algorithm ~ std.range
On Friday, 31 January 2014 at 00:13:02 UTC, Meta wrote:
Ranges, templates and structs.
~= CTFE ~ UFCS
~= std.algorithm ~ std.range
~= immutable ~ (isProperlyImplemented!shared ? shared :
repeatedlyAskAndreiWhatsGoingOnWith!shared
On Friday, 31 January 2014 at 00:17:47 UTC, Stanislav Blinov
wrote:
On Friday, 31 January 2014 at 00:13:02 UTC, Meta wrote:
Ranges, templates and structs.
~= CTFE ~ UFCS
~= std.algorithm ~ std.range
~= immutable ~ (isProperlyImplemented!shared ? shared :
On 01/30/2014 07:17 PM, Stanislav Blinov wrote:
On Friday, 31 January 2014 at 00:13:02 UTC, Meta wrote:
Ranges, templates and structs.
~= CTFE ~ UFCS
~= std.algorithm ~ std.range
~= immutable ~ (isProperlyImplemented!shared ? shared :
repeatedlyAskAndreiWhatsGoingOnWith!shared
);
//
On Thursday, 30 January 2014 at 20:05:11 UTC, Tofu Ninja wrote:
I hear it thrown around a lot but what does it actually mean?
What does the ideal D code look like? What kind of things
should some one think about if they are trying to do idiomatic
D?
Here is one of the few previous threads
On Friday, 31 January 2014 at 04:53:48 UTC, Matt Soucy wrote:
Ranges, templates and structs.
~= CTFE ~ UFCS
~= std.algorithm ~ std.range
~= immutable ~ (isProperlyImplemented!shared ? shared :
repeatedlyAskAndreiWhatsGoingOnWith!shared
);
// Sorry but that was going to cause a slight
Sorry, forgot to post the code:
http://pastie.org/4109337
Is there no way to edit posts?
it useful
it's always better to write it the way it was meant to be written.
Firstly, is there any good resource on what idiomatic D usage is?
For instance Go has a huge page called Effective Go which tells
you how you should use features, rather than what they are.
And secondly, I would be grateful
Matt Diesel:
Firstly, is there any good resource on what idiomatic D usage
is? For instance Go has a huge page called Effective Go which
tells you how you should use features, rather than what they
are.
I don't know any such page, but it looks like an interesting
addition for the online
On Mon, 18 Jun 2012 18:22:34 +0200, Matt Diesel wrote:
Sorry, forgot to post the code:
http://pastie.org/4109337
Is there no way to edit posts?
A couple of observations:
- According to the D style guide (http://dlang.org/dstyle.html), you
should prefer to capitalize class and struct
Thanks to both of you, that was exactly the sort of input I was
looking for :)
The D Style guide looks like what I wanted. It's more just about
formatting but that should be enough for now.
I can't really reply to each individual point, but there is a lot
of new stuff there that at first
teach myself a language no problem, but to make it useful
it's always better to write it the way it was meant to be written.
Firstly, is there any good resource on what idiomatic D usage is?
For instance Go has a huge page called Effective Go which tells
you how you should use features, rather
89 matches
Mail list logo