On Thursday, 8 March 2018 at 15:13:09 UTC, Steven Schveighoffer
wrote:
On 3/8/18 9:58 AM, joe wrote:
On Monday, 5 March 2018 at 10:57:35 UTC, Jonathan M Davis
wrote:
Here's something I wrote up on const:
/snip
May be not entirely related, but a little gotcha.
given:
interface XY {}
class F
On Monday, 5 March 2018 Jonathan M Davis wrote at
http://jmdavisprog.com/articles/why-const-sucks.html:
What Java has instead is `final`, which IMHO is borderline
useless
In Java `final` is extremely useful for efficient threadsafe
code.
On 3/8/18 9:58 AM, joe wrote:
On Monday, 5 March 2018 at 10:57:35 UTC, Jonathan M Davis wrote:
Here's something I wrote up on const:
/snip
May be not entirely related, but a little gotcha.
given:
interface XY {}
class Foo: XY {}
class Bar: XY {}
void doSomething(in XY sth)
{
auto foo =
On Monday, 5 March 2018 at 10:57:35 UTC, Jonathan M Davis wrote:
Here's something I wrote up on const:
/snip
May be not entirely related, but a little gotcha.
given:
interface XY {}
class Foo: XY {}
class Bar: XY {}
void doSomething(in XY sth)
{
auto foo = cast(Foo)sth; // error in @safe
On Tuesday, 6 March 2018 at 17:41:42 UTC, H. S. Teoh wrote:
Yeah, Andrei has admitted before that this is probably what he
would do today, if he were given a second chance to design
ranges. But at the time, the landscape of D was rather
different, and certain language features didn't exist yet
On Monday, 5 March 2018 at 17:38:52 UTC, H. S. Teoh wrote:
struct Container {
auto opSlice() const {
static struct Result {
private Container impl;
private int n; // internal mutable st
On Tuesday, March 06, 2018 19:06:25 Martin Nowak via Digitalmars-d-announce
wrote:
> On Tuesday, 6 March 2018 at 18:17:58 UTC, Jonathan M Davis wrote:
> > I'm not actually convinced that killing auto-decoding is really
> > much better.
>
> I don't think the problem is auto-decoding in string range
On Tuesday, 6 March 2018 at 18:17:58 UTC, Jonathan M Davis wrote:
I'm not actually convinced that killing auto-decoding is really
much better.
I don't think the problem is auto-decoding in string range
adapters, but repeated validation.
https://issues.dlang.org/show_bug.cgi?id=14519#c32
If yo
On Tuesday, March 06, 2018 10:47:36 H. S. Teoh via Digitalmars-d-announce
wrote:
> On Tue, Mar 06, 2018 at 01:31:39PM -0500, Steven Schveighoffer via
Digitalmars-d-announce wrote:
> > On 3/6/18 10:39 AM, Jonathan M Davis wrote:
> > > Yeah. If you're dealing with generic code rather than a specifi
On Tue, Mar 06, 2018 at 01:31:39PM -0500, Steven Schveighoffer via
Digitalmars-d-announce wrote:
> On 3/6/18 10:39 AM, Jonathan M Davis wrote:
> > Yeah. If you're dealing with generic code rather than a specific
> > range type that you know is implicitly saved when copied, you have
> > to use save
On 3/6/18 10:39 AM, Jonathan M Davis wrote:
Yeah. If you're dealing with generic code rather than a specific range type
that you know is implicitly saved when copied, you have to use save so often
that it's painful, and almost no one does it. e.g.
equal(lhs.save, rhs.save)
or
immutable result
On Tue, Mar 06, 2018 at 11:20:56AM -0700, Jonathan M Davis via
Digitalmars-d-announce wrote:
> On Tuesday, March 06, 2018 09:41:42 H. S. Teoh via Digitalmars-d-announce
> wrote:
> > As they say, hindsight is always 20/20. But it wasn't so easy to
> > foresee the consequences at the time when the
On Tuesday, March 06, 2018 09:41:42 H. S. Teoh via Digitalmars-d-announce
wrote:
> As they say, hindsight is always 20/20. But it wasn't so easy to
> foresee the consequences at the time when the very concept of ranges was
> still brand new.
Except that even worse, I'd argue that hindsight reall
On Tuesday, March 06, 2018 09:36:43 H. S. Teoh via Digitalmars-d-announce
wrote:
> Andrei has said before, and probably on more than one occasion, that if
> he were to redesign ranges today, one of the things he would do
> differently was to change the definition of forward range so that .save
> i
On Mon, Mar 05, 2018 at 10:21:47PM -0500, Nick Sabalausky (Abscissa) via
Digitalmars-d-announce wrote:
> On 03/05/2018 12:38 PM, H. S. Teoh wrote:
> >
> > This broke the by-value assumption inherent in much of Phobos code,
>
> Wait, seriously? Phobos frequently passes ranges by value? I sincerel
On Tue, Mar 06, 2018 at 08:39:41AM -0700, Jonathan M Davis via
Digitalmars-d-announce wrote:
[...]
> Yeah. If you're dealing with generic code rather than a specific range
> type that you know is implicitly saved when copied, you have to use
> save so often that it's painful, and almost no one doe
On Tuesday, 6 March 2018 at 15:39:41 UTC, Jonathan M Davis wrote:
[snip]
How well Phobos has done with this has improved over time as
more and better testing has been added (testing for reference
type ranges is probably the most critical to finding this
particular problem), but I doubt that P
On Tuesday, 6 March 2018 at 15:23:52 UTC, Adam D. Ruppe wrote:
On Tuesday, 6 March 2018 at 03:21:47 UTC, Nick Sabalausky
(Abscissa) wrote:
The definition of "what is a forward/non-forward range" for
struct-based ranges should have been "is this() @disabled
(non-forward range), or is this() enab
On Tuesday, March 06, 2018 15:23:52 Adam D. Ruppe via Digitalmars-d-announce
wrote:
> On Tuesday, 6 March 2018 at 03:21:47 UTC, Nick Sabalausky
>
> (Abscissa) wrote:
> > Wait, seriously? Phobos frequently passes ranges by value?
>
> You *should* pass most ranges by value, just like how you should
On Tuesday, 6 March 2018 at 03:21:47 UTC, Nick Sabalausky
(Abscissa) wrote:
Wait, seriously? Phobos frequently passes ranges by value?
You *should* pass most ranges by value, just like how you should
rarely use `ref T[]` or `T[]*`. Ranges, like slices, are
typically already small references t
On Tuesday, 6 March 2018 at 10:02:10 UTC, Radu wrote:
On Monday, 5 March 2018 at 10:57:35 UTC, Jonathan M Davis wrote:
Here's something I wrote up on const:
http://jmdavisprog.com/articles/why-const-sucks.html
I suppose that it's not exactly the most positive article, but
I feel that it's acc
On Tuesday, 6 March 2018 at 12:05:26 UTC, Dukc wrote:
I think we have a bug here. I believe postblits should behave
like constructors in both events.
https://issues.dlang.org/show_bug.cgi?id=18561
On 3/6/18 1:49 AM, Jonathan M Davis wrote:
Regardless, I doubt that the design of ranges is going to be changed at this
point given the amount of code that would break as a result, and these sort
of changes are not backwards compatible.
I sometimes think we would be better off to drop InputRan
On Tuesday, 6 March 2018 at 11:03:24 UTC, Nemanja Boric wrote:
title = title.dup;// doesn't work anymore
Strange! You're right it does not when the type declares a member
as const, yet:
On Monday, 5 March 2018 at 10:57:35 UTC, Jonathan M Davis
wrote (in the article):
And if an objec
On Tuesday, 6 March 2018 at 10:49:48 UTC, Dukc wrote:
On Monday, 5 March 2018 at 10:57:35 UTC, Jonathan M Davis wrote
(in the article):
The problem is that the entire object must be fully
initialized before
the body of the postblit constructor is run. That means that
any member
variables which
On Monday, 5 March 2018 at 10:57:35 UTC, Jonathan M Davis wrote
(in the article):
The problem is that the entire object must be fully initialized
before
the body of the postblit constructor is run. That means that
any member
variables which are const or immutable are stuck at whatever
they were
On Monday, 5 March 2018 at 10:57:35 UTC, Jonathan M Davis wrote:
Here's something I wrote up on const:
http://jmdavisprog.com/articles/why-const-sucks.html
I suppose that it's not exactly the most positive article, but
I feel that it's accurate.
- Jonathan M Davis
Spot on article, and touc
On Monday, 5 March 2018 at 13:59:02 UTC, Adam D. Ruppe wrote:
On Monday, 5 March 2018 at 10:57:35 UTC, Jonathan M Davis wrote:
Here's something I wrote up on const:
And then, of course, like you said "don't use it" is the
solution to most of the const system's flaws anyway which
seems to
On Monday, 5 March 2018 at 10:57:35 UTC, Jonathan M Davis wrote:
Here's something I wrote up on const:
http://jmdavisprog.com/articles/why-const-sucks.html
I suppose that it's not exactly the most positive article, but
I feel that it's accurate.
- Jonathan M Davis
Its amazing how typed lan
On Monday, March 05, 2018 22:21:47 Nick Sabalausky via Digitalmars-d-
announce wrote:
> On 03/05/2018 12:38 PM, H. S. Teoh wrote:
> > This broke the by-value
> > assumption inherent in much of Phobos code,
>
> Wait, seriously? Phobos frequently passes ranges by value? I sincerely
> hope that's onl
On 03/05/2018 12:38 PM, H. S. Teoh wrote:
This broke the by-value
assumption inherent in much of Phobos code,
Wait, seriously? Phobos frequently passes ranges by value? I sincerely
hope that's only true for class-based ranges and forward-ranges (and
more specifically, only forward ranges whe
On Monday, 5 March 2018 at 13:48:23 UTC, Adam D. Ruppe wrote:
Just a semantic note, it is "straitjacket". "straight" is like
a non-wiggly line. "strait" means narrow or constricted. Thus,
the straitjacket is a jacket that constricts your movement.
Of course, using "straight" is such a common m
On Monday, 5 March 2018 at 13:48:23 UTC, Adam D. Ruppe wrote:
Just a semantic note, it is "straitjacket". "straight" is like
a non-wiggly line. "strait" means narrow or constricted. Thus,
the straitjacket is a jacket that constricts your movement.
Of course, using "straight" is such a common m
On Monday, 5 March 2018 at 13:48:23 UTC, Adam D. Ruppe wrote:
Just a semantic note, it is "straitjacket". "straight" is like
a non-wiggly line. "strait" means narrow or constricted. Thus,
the straitjacket is a jacket that constricts your movement.
Of course, using "straight" is such a common
On Mon, Mar 05, 2018 at 11:04:49AM -0700, Jonathan M Davis via
Digitalmars-d-announce wrote:
> On Monday, March 05, 2018 09:38:52 H. S. Teoh via Digitalmars-d-announce
> wrote:
> > Eventually, I discovered that the underlying problem was that
> > Result, as defined above, was a struct with a cons
On Monday, March 05, 2018 09:38:52 H. S. Teoh via Digitalmars-d-announce
wrote:
> Eventually, I discovered
> that the underlying problem was that Result, as defined above, was a
> struct with a const member, and therefore it was illegal to assign it to
> a variable of the same type outside of init
On Monday, March 05, 2018 17:35:28 ShadoLight via Digitalmars-d-announce
wrote:
> Very interesting and well written! Jonathan, your experiences
> with const in C++/Java just about matches my experiences with it.
> I also feel that the situation in D is less than ideal in this
> regard.
>
> First,
Very interesting and well written! Jonathan, your experiences
with const in C++/Java just about matches my experiences with it.
I also feel that the situation in D is less than ideal in this
regard.
First, a small (for sure copy-pasta) typo in your article:
const(int[]) arr1 = getArray();
con
On Mon, Mar 05, 2018 at 03:57:35AM -0700, Jonathan M Davis via
Digitalmars-d-announce wrote:
> Here's something I wrote up on const:
>
> http://jmdavisprog.com/articles/why-const-sucks.html
>
> I suppose that it's not exactly the most positive article, but I feel
> that it's accurate.
[...]
Yea
On Monday, 5 March 2018 at 10:57:35 UTC, Jonathan M Davis wrote:
Here's something I wrote up on const:
http://jmdavisprog.com/articles/why-const-sucks.html
I suppose that it's not exactly the most positive article, but
I feel that it's accurate.
- Jonathan M Davis
Interesting read and it e
On Monday, 5 March 2018 at 13:49:43 UTC, Jonathan M Davis wrote:
On Monday, March 05, 2018 11:38:05 Atila Neves via
Digitalmars-d-announce wrote:
I used to use `immutable`, but gradually came around to only
using it if I have to send data to another thread, otherwise
it's too much of a hassle.
On Monday, March 05, 2018 13:53:21 SimonN via Digitalmars-d-announce wrote:
> On Monday, 5 March 2018 at 10:57:35 UTC, Jonathan M Davis wrote:
> > Here's something I wrote up on const:
> Excellent read! I enjoyed the history of proposed solutions.
>
> I've run into the trouble with annotated opEqua
On Monday, 5 March 2018 at 10:57:35 UTC, Jonathan M Davis wrote:
Here's something I wrote up on const:
http://jmdavisprog.com/articles/why-const-sucks.html
I suppose that it's not exactly the most positive article, but
I feel that it's accurate.
- Jonathan M Davis
Great read for a Monday.
On Monday, 5 March 2018 at 10:57:35 UTC, Jonathan M Davis wrote:
Here's something I wrote up on const:
So as to the main thrust, I generally agree. In fact, I think
const is almost useless even if you want to use it fully: you
said immutable is better in many places, and yes, but in additio
On Monday, 5 March 2018 at 10:57:35 UTC, Jonathan M Davis wrote:
Here's something I wrote up on const:
Excellent read! I enjoyed the history of proposed solutions.
I've run into the trouble with annotated opEquals in classes
several times. I believe an empty/nonexistant Object class is the
c
On Monday, March 05, 2018 13:48:23 Adam D. Ruppe via Digitalmars-d-announce
wrote:
> Just a semantic note, it is "straitjacket". "straight" is like a
> non-wiggly line. "strait" means narrow or constricted. Thus, the
> straitjacket is a jacket that constricts your movement.
>
> Of course, using "s
On Monday, March 05, 2018 11:38:05 Atila Neves via Digitalmars-d-announce
wrote:
> I used to use `immutable`, but gradually came around to only
> using it if I have to send data to another thread, otherwise it's
> too much of a hassle.
Aside from the whole std.concurrency situation, I generally u
Just a semantic note, it is "straitjacket". "straight" is like a
non-wiggly line. "strait" means narrow or constricted. Thus, the
straitjacket is a jacket that constricts your movement.
Of course, using "straight" is such a common mistake it has
become generally accepted... but still, I like b
On Monday, 5 March 2018 at 10:57:35 UTC, Jonathan M Davis wrote:
Here's something I wrote up on const:
http://jmdavisprog.com/articles/why-const-sucks.html
I suppose that it's not exactly the most positive article, but
I feel that it's accurate.
- Jonathan M Davis
Brilliant article, Johath
On Monday, 5 March 2018 at 10:57:35 UTC, Jonathan M Davis wrote:
Here's something I wrote up on const:
http://jmdavisprog.com/articles/why-const-sucks.html
I suppose that it's not exactly the most positive article, but
I feel that it's accurate.
- Jonathan M Davis
My biggest issues with co
Here's something I wrote up on const:
http://jmdavisprog.com/articles/why-const-sucks.html
I suppose that it's not exactly the most positive article, but I feel that
it's accurate.
- Jonathan M Davis
51 matches
Mail list logo