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
>
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 Sunday, 19 March 2023 at 08:47:32 UTC, Basile B. wrote:
On Sunday, 19 March 2023 at 07:20:17 UTC, Jeremy wrote:
[...]
The colon-form, aka "selective import" has for effect
1. to create a local alias so this can indeed speedup symbol
lookups in the sense that search will succeed before
On Sunday, 19 March 2023 at 07:20:17 UTC, Jeremy wrote:
Hello, is there any difference at all between the following
lines, as an example:
```d
import std.regex;
import std.regex : matchFirst;
```
What technical differences does it make (except for having the
identifier available), using the
On Thursday, 10 November 2022 at 18:30:16 UTC, Paul Backus wrote:
On Thursday, 10 November 2022 at 17:04:31 UTC, mw wrote:
Hi,
Anyone can help explain what is the difference between
x.atomicOp!"+="(1) and atomicFetchAdd(x, 1)?
Looking at the source in druntime, `atomicOp!"+="` forwards to
On Thursday, 10 November 2022 at 17:04:31 UTC, mw wrote:
Hi,
Anyone can help explain what is the difference between
x.atomicOp!"+="(1) and atomicFetchAdd(x, 1)?
Looking at the source in druntime, `atomicOp!"+="` forwards to
`atomicFetchAdd` internally, so they should have the same
> Either way, generic code should never be using a range after
> it's been copied, and copying is a key part of how
> idiomatic, range-based code works in D.
OK. Thanks for instructions. I shall give it a try.
On Sunday, February 16, 2020 12:22:01 PM MST Paul Backus via Digitalmars-d-
learn wrote:
> On Sunday, 16 February 2020 at 18:11:11 UTC, Jonathan M Davis
>
> wrote:
> > Either way, generic code should never be using a range after
> > it's been copied, and copying is a key part of how idiomatic,
> >
On Sunday, 16 February 2020 at 18:11:11 UTC, Jonathan M Davis
wrote:
Either way, generic code should never be using a range after
it's been copied, and copying is a key part of how idiomatic,
range-based code works in D.
"Copy and then never use the original again" is conceptually the
same
On Sunday, February 16, 2020 10:53:36 AM MST Paul Backus via Digitalmars-d-
learn wrote:
> On Sunday, 16 February 2020 at 17:10:24 UTC, Jonathan M Davis
>
> wrote:
> > On Sunday, February 16, 2020 7:29:11 AM MST uranuz via
> >
> >> This is working fine with disabled postblit...
> >> import std;
>
On Sunday, 16 February 2020 at 17:10:24 UTC, Jonathan M Davis
wrote:
On Sunday, February 16, 2020 7:29:11 AM MST uranuz via
This is working fine with disabled postblit...
import std;
struct SS
{
@disable this(this); // Disabled copy
bool _empty = false;
bool empty() @property
On Sunday, February 16, 2020 6:52:17 AM MST uranuz via Digitalmars-d-learn
wrote:
> It's very bad. Because there seem that when I use range based
> algorithm I need to take two things into account. The first is
> how algrorithm is implemented. If it creates copies of range
> inside or pass it by
On Sunday, February 16, 2020 7:29:11 AM MST uranuz via Digitalmars-d-learn
wrote:
> On Sunday, 16 February 2020 at 12:38:51 UTC, Jonathan M Davis
>
> wrote:
> > On Sunday, February 16, 2020 3:41:31 AM MST uranuz via
> >
> > Digitalmars-d-learn wrote:
> >> I have reread presentation:
> >>
On Sunday, 16 February 2020 at 12:38:51 UTC, Jonathan M Davis
wrote:
On Sunday, February 16, 2020 3:41:31 AM MST uranuz via
Digitalmars-d-learn wrote:
I have reread presentation:
http://dconf.org/2015/talks/davis.pdf
We declare that `pure` input range cannot be `unpoped` and we
can't return to
In general for value-semantics and ref-semantics the different
code is actually needed. But generic algorithm try to pretend
that the logic is the same. But it's not true. But in wide subset
of trivial algorithm it's true. So it's incorrectly interpolated
that it's true for every case. The
It's very bad. Because there seem that when I use range based
algorithm I need to take two things into account. The first is
how algrorithm is implemented. If it creates copies of range
inside or pass it by reference. And the second is how the range
is implemented if it has value or reference
On Sunday, February 16, 2020 3:41:31 AM MST uranuz via Digitalmars-d-learn
wrote:
> I have reread presentation:
> http://dconf.org/2015/talks/davis.pdf
> We declare that `pure` input range cannot be `unpoped` and we
> can't return to the previous position of it later at the time. So
> logically
I have reread presentation:
http://dconf.org/2015/talks/davis.pdf
We declare that `pure` input range cannot be `unpoped` and we
can't return to the previous position of it later at the time. So
logically there is no sence of copying input range at all. So
every Phobos algorithm that declares
Also I see the problemme that someone can think that it creates
an input range, because he doesn't provide `save` method, but
actually it creates forward range unexpectedly, because it is
copyable. And it makes what is actually happening in code more
difficult. Some algrorithm can take ranges
Actually, as I understand it, the main reason that save was
introduced was so that classes could be forward ranges
I have use of ranges as a classes in my code that rely on classes
and polymorthism, but it's usually an InputRange that implements
Phobos interface:
On 2/15/20 9:45 AM, Jonathan M Davis wrote:
On Saturday, February 15, 2020 7:34:42 AM MST Steven Schveighoffer via
Digitalmars-d-learn wrote:
On 2/15/20 5:53 AM, uranuz wrote:
I am interested in current circumstances when we have new copy
constructor feature what is the purpose of having range
On Saturday, February 15, 2020 7:34:42 AM MST Steven Schveighoffer via
Digitalmars-d-learn wrote:
> On 2/15/20 5:53 AM, uranuz wrote:
> > I am interested in current circumstances when we have new copy
> > constructor feature what is the purpose of having range `save`
> > primitive? For me they
On 2/15/20 5:53 AM, uranuz wrote:
I am interested in current circumstances when we have new copy
constructor feature what is the purpose of having range `save`
primitive? For me they look like doing basicaly the same thing. And when
looking in some source code of `range` module the most common
On Thursday, 10 October 2019 at 15:56:36 UTC, Just Dave wrote:
I'm trying to get my head around mixing templates. I'm using it
as kind of a replacement for class inheritance as it seems to
fit better composition over inheritance. So I do something like:
mixin template NumberTemplate()
On 25.09.19 22:36, WhatMeWorry wrote:
On Wednesday, 25 September 2019 at 19:25:06 UTC, Ali Çehreli wrote:
On 09/25/2019 12:06 PM, WhatMeWorry wrote:
[...]
> In short, is there anytime that one would want to use
"slice[] =
> something" syntax?I
That changes element values.
Ok. But which
On Wednesday, 25 September 2019 at 20:36:47 UTC, WhatMeWorry
wrote:
Ok. But which element(s)? In my specific case, I was using
[]. Is
waste[] = waste[0..$-1];
even semantically meaningful? Because the LDC compiler had no
problem compiling it.
`waste[]` is just shorthand for
On Wednesday, 25 September 2019 at 19:25:06 UTC, Ali Çehreli
wrote:
On 09/25/2019 12:06 PM, WhatMeWorry wrote:
> I was
> assuming that [] meant "the entirety" of the array.
Assuming we're talking about D slices, Yes. (It could be a
user-defined type with surprisingly different semantics.)
>
On 09/25/2019 12:06 PM, WhatMeWorry wrote:
> I was
> assuming that [] meant "the entirety" of the array.
Assuming we're talking about D slices, Yes. (It could be a user-defined
type with surprisingly different semantics.)
> In short, is there anytime that one would want to use "slice[] =
>
On Monday, June 05, 2017 10:46:39 Kagamin via Digitalmars-d-learn wrote:
> On Sunday, 4 June 2017 at 08:51:44 UTC, Jonathan M Davis wrote:
> >> On Saturday, 3 June 2017 at 06:19:29 UTC, Jonathan M Davis
> >>
> >> wrote:
> >> > Assigning Nullable!Test.init is equivalent to setting the
> >> >
On Sunday, 4 June 2017 at 08:51:44 UTC, Jonathan M Davis wrote:
On Saturday, 3 June 2017 at 06:19:29 UTC, Jonathan M Davis
wrote:
> Assigning Nullable!Test.init is equivalent to setting the
> internal value to Test.init and setting _isNull to false.
T _value;
bool _isNull = true;
So it was
On Sunday, June 04, 2017 09:31:24 vit via Digitalmars-d-learn wrote:
> On Sunday, 4 June 2017 at 09:04:14 UTC, Jonathan M Davis wrote:
> > [...]
>
> Why Nullable!T call destroy for reference types?
It calls destroy for everything. Why it does that instead of simply
assigning T.init and setting
On Sunday, 4 June 2017 at 09:04:14 UTC, Jonathan M Davis wrote:
[...]
Why Nullable!T call destroy for reference types?
On Sunday, 4 June 2017 at 09:04:14 UTC, Jonathan M Davis wrote:
if throwing in a destructor is considered a runtime error,
perhaps another valid enhancement would be to statically
disallow throwing Exceptions in destructors, i.e. *require*
them be nothrow?..
My initial reaction would be
On Saturday, June 03, 2017 08:17:18 Stanislav Blinov via Digitalmars-d-learn
wrote:
> On Saturday, 3 June 2017 at 08:01:14 UTC, Jonathan M Davis wrote:
> > On Saturday, June 03, 2017 06:41:44 Stanislav Blinov via
> >
> > Digitalmars-d-learn wrote:
> >> On Saturday, 3 June 2017 at 06:19:29 UTC,
On Saturday, June 03, 2017 14:30:05 Kagamin via Digitalmars-d-learn wrote:
> On Saturday, 3 June 2017 at 06:19:29 UTC, Jonathan M Davis wrote:
> > Assigning Nullable!Test.init is equivalent to setting the
> > internal value to Test.init and setting _isNull to false.
>
> Eh? Does it mean Nullable
On Saturday, 3 June 2017 at 06:19:29 UTC, Jonathan M Davis wrote:
Assigning Nullable!Test.init is equivalent to setting the
internal value to Test.init and setting _isNull to false.
Eh? Does it mean Nullable is default initialized to some non-null
default value?
On Saturday, 3 June 2017 at 06:19:29 UTC, Jonathan M Davis wrote:
[...]
thanks
On Saturday, 3 June 2017 at 08:01:14 UTC, Jonathan M Davis wrote:
On Saturday, June 03, 2017 06:41:44 Stanislav Blinov via
Digitalmars-d-learn wrote:
On Saturday, 3 June 2017 at 06:19:29 UTC, Jonathan M Davis
wrote:
> looking at what rt_finalize does, I don't see why it
> couldn't be nothrow.
On Saturday, June 03, 2017 06:41:44 Stanislav Blinov via Digitalmars-d-learn
wrote:
> On Saturday, 3 June 2017 at 06:19:29 UTC, Jonathan M Davis wrote:
> > looking at what rt_finalize does, I don't see why it couldn't
> > be nothrow. So, unless I'm missing something, it seems like
> > that would
On Saturday, 3 June 2017 at 06:19:29 UTC, Jonathan M Davis wrote:
looking at what rt_finalize does, I don't see why it couldn't
be nothrow. So, unless I'm missing something, it seems like
that would be a good enhancement.
- Jonathan M Davis
Presently, rt_finalize cannot be made nothrow, or
On Saturday, June 03, 2017 05:52:55 vit via Digitalmars-d-learn wrote:
> Hello,
> What's the difference between x = Nullable!Test.init and
> x.nullify?
>
>
> class Test{}
>
> void test()pure nothrow{
> Nullable!Test x;
>
> x = Nullable!Test.init; //OK
> x.nullify;
On 11/09/2016 01:20 AM, Ali Çehreli wrote:
> arrayPtrDiff() is at the bottom of the same file but works correctly
> only for char strings:
>
> https://github.com/dlang/phobos/blob/master/std/format.d#L6573
What I meant is, using arrayPtrDiff() is correct only for char strings.
Otherwise,
On 11/09/2016 12:21 AM, Vadim Lopatin wrote:
Looks like bug.
dchar[] and wchar[] format strings support less specifiers than char[]
import std.format;
string test1 = "%02d".format(1); // works
assert(test1 == "01");
dstring test2 = "%d"d.format(1); // works
On Wednesday, 9 November 2016 at 08:21:53 UTC, Vadim Lopatin
wrote:
Looks like bug.
dchar[] and wchar[] format strings support less specifiers than
char[]
import std.format;
string test1 = "%02d".format(1); // works
assert(test1 == "01");
dstring test2 =
On Sunday, 24 January 2016 at 20:56:20 UTC, Jon D wrote:
I'm trying to identify the preferred ways to lower case a
string. In std.uni there are two functions that return the
lower case form of a string: toLower() and asLowerCase(). There
is also toLowerInPlace().
toLower will allocate a new
On Sunday, 24 January 2016 at 21:04:46 UTC, Adam D. Ruppe wrote:
On Sunday, 24 January 2016 at 20:56:20 UTC, Jon D wrote:
I'm trying to identify the preferred ways to lower case a
string. In std.uni there are two functions that return the
lower case form of a string: toLower() and
On Saturday, 12 September 2015 at 08:13:33 UTC, Bahman Movaqar
wrote:
Is there any or they are just simply syntactically equivalent?
Are there any official docs on this?
it's like a raw string (prefixed with a r) so there is escaped
char:
r"\": correct token for a string, terminal " is not
On Friday, 18 September 2015 at 09:34:38 UTC, BBasile wrote:
On Saturday, 12 September 2015 at 08:13:33 UTC, Bahman Movaqar
wrote:
Is there any or they are just simply syntactically equivalent?
Are there any official docs on this?
it's like a raw string (prefixed with a r) so there is escaped
On Friday, 18 September 2015 at 09:35:53 UTC, BBasile wrote:
On Friday, 18 September 2015 at 09:34:38 UTC, BBasile wrote:
On Saturday, 12 September 2015 at 08:13:33 UTC, Bahman Movaqar
wrote:
Is there any or they are just simply syntactically
equivalent? Are there any official docs on this?
On 09/12/2015 01:13 AM, Bahman Movaqar wrote:
Is there any or they are just simply syntactically equivalent?
Are there any official docs on this?
I realized that there was no index entry for back tick in my book. I've
just added that and provided an Index section for the web version of the
On Saturday, 12 September 2015 at 08:13:33 UTC, Bahman Movaqar
wrote:
Is there any or they are just simply syntactically equivalent?
Are there any official docs on this?
What if I told you, you should search the official reference
before asking such things in the forum?
On 09/12/2015 12:52 PM, NX wrote:
> What if I told you, you should search the official reference before
> asking such things in the forum?
I did search the net for terms such as "d lang back quoted string" or "d
lang multi line string" or "d lang string interpolation" before asking here.
However
On Saturday, 12 September 2015 at 08:22:03 UTC, NX wrote:
What if I told you, you should search the official reference
before asking such things in the forum?
Searching is kinda hard, so I encourage people to ask if
something doesn't come up quickly. And then we need to be sure to
always
On Monday, 26 January 2015 at 01:57:04 UTC, bearophile wrote:
Laeeth Isharc:
I think concatenation and append are used as synonyms (the
same meaning is meant). a~=b or a=a~b
a=a~b always allocates a new array, while a~=b sometimes
re-allocates in place.
Bye,
bearophile
Perfect! Thank
On Monday, January 26, 2015 01:17:15 WhatMeWorry via Digitalmars-d-learn wrote:
Ok, I just made up that word. But what is the difference between
appending and concatenating? Page 100 of TPDL says The result
of the concatenation is a new array... and the section on
appending talks about
On Monday, 26 January 2015 at 01:17:17 UTC, WhatMeWorry wrote:
Ok, I just made up that word. But what is the difference
between appending and concatenating? Page 100 of TPDL says
The result of the concatenation is a new array... and the
section on appending talks about possibly needing
On Monday, 26 January 2015 at 01:57:04 UTC, bearophile wrote:
Laeeth Isharc:
I think concatenation and append are used as synonyms (the
same meaning is meant). a~=b or a=a~b
a=a~b always allocates a new array, while a~=b sometimes
re-allocates in place.
Bye,
bearophile
Thanks. That
On Monday, 26 January 2015 at 01:17:17 UTC, WhatMeWorry wrote:
Ok, I just made up that word. But what is the difference
between appending and concatenating? Page 100 of TPDL says
The result of the concatenation is a new array... and the
section on appending talks about possibly needing
Laeeth Isharc:
I think concatenation and append are used as synonyms (the same
meaning is meant). a~=b or a=a~b
a=a~b always allocates a new array, while a~=b sometimes
re-allocates in place.
Bye,
bearophile
On Tuesday, 4 February 2014 at 08:08:30 UTC, Suliman wrote:
What difference between
if ((x = stdin.readln().chomp) is q)
and
if ((x = stdin.readln().chomp) == q)
?
My interpretation of tdpl p57:
'is' compares for alias equality for arrays and classes.
Otherwise they are the same.
My interpretation of tdpl p57:
'is' compares for alias equality for arrays and classes.
Otherwise they are the same.
So should next code have same behavior if I will use is instead
of ==
import std.stdio;
import std.string;
void main()
{
getchar();
}
void getchar()
{
On Tuesday, 4 February 2014 at 08:25:18 UTC, Suliman wrote:
My interpretation of tdpl p57:
'is' compares for alias equality for arrays and classes.
Otherwise they are the same.
So should next code have same behavior if I will use is instead
of ==
import std.stdio;
import std.string;
void
Suliman:
What difference between
if ((x = stdin.readln().chomp) is q)
and
if ((x = stdin.readln().chomp) == q)
?
is performs a raw comparison of just the values, and the value
of a string is its ptr and length field. While == compares
their contents. So you want to use == here because you
On Tue, 04 Feb 2014 03:08:28 -0500, Suliman everm...@live.ru wrote:
What difference between
if ((x = stdin.readln().chomp) is q)
and
if ((x = stdin.readln().chomp) == q)
?
The first compares the pointer of the arrays. The second compares the
contents of the array. Both check length as well
25.02.2013 3:59, monarch_dodra пишет:
I don't see any any calls to remove, so I'm not sure what the algorithm
is. Wouldn't patch just grow and grow and grow?
Regardless, the design of DList is currently flawed (but a pull is open
to fix it), in the sense that a DList is just a handle on a
On Sunday, 24 February 2013 at 20:16:26 UTC, Alexandr Druzhinin
wrote:
I used in my application DList (code is large and I couldn't
reduce it) and the application allocates memory always. I can
not realize why and don't know it now. But when I replaced
DList by SList (and even dynamic array)
Here is my prototype COM compile-time reflection based wrapper mixin
(which I have abandoned in favor of alias this since it covers 95% of my
use cases even though it isn't perfectly safe). I am new at D so you
have been warned, though this part of the language seems pretty
straightforward
What are the differences between class instantiated by scope and struct
itself?
Two, that comes to my mind are:
- vtable existance (yep, struct with inheritation - that's what i like)
- lol, i just forgot while writing this e-mail
First off, I would point out that scoped classes are going
Firstly, thanks for comprehensive answer and I'd like to excuse for my
stupid mistakes, which are caused by learning a lot and not actually
programming.
On date 2011-05-02 23:03, Jonathan M Davis wrote:
Classes are reference types and are meant to be on the heap.
Yeah, value vs reference
Firstly, thanks for comprehensive answer and I'd like to excuse for my
stupid mistakes, which are caused by learning a lot and not actually
programming.
On date 2011-05-02 23:03, Jonathan M Davis wrote:
Classes are reference types and are meant to be on the heap.
Yeah, value vs
Mariusz Gliwiński wrote:
I'll clarify myself:
All i would need is extending - without polymorphism.
Containment, can be solution for fields which doesn't annoys so much
(although image in auto-generated documentation, just like it's with
subclassing, would be nice).
Unfortunately, the worse case
71 matches
Mail list logo