e, on the other hand Rust
is a bit more free than Swift now).
Bear hugs,
bearophile
s. It just needs to
be implemented correctly.
Bye,
bearophile
age has being deleted... :-)
https://www.reddit.com/r/programming/comments/49y7sc/11_myths_about_ada/
Bye,
bearophile
xenon325:
Doesn't http://wiki.dlang.org/DIP25 fix this ?
I think DIP25 is designed to be only a partial solution, it's not
a complete memory safety story.
Bye,
bearophile
e without having any experience of
template metaprogramming, CTFE, and the like, and gradually
absorb language features as you go. Phobos is pretty readable,
on the whole. I agree with bearophile about GC making it
easier in the beginning.
bearophile:
"I am sometimes able to write working D c
are
sufficiently different, there's minimal overlapping in their
purposes and niches.
Bye,
bearophile
and so on). I don't know if
such safety features will be added to Rust, I am dubious.
In the C/Ada world you have language subsets like MISRA/SPARK
that people use in high integrity system. I think Rust still
lacks something like that.
Bye,
bearophile
BBaz:
So I don't know...and I ask, should the garbages from
bearophile be closed ?
Hello, I use D every day, and there are several functions that
I'd like in Phobos. I think all/most of them can be of general
usefulness. While I am often wrong, those ERs come from plenty of
ponce:
Paper: http://vlang.org/dvcon2014.pdf
I'd say that's pretty huge!
Very nice.
Bye,
bearophile
:-)
Bye,
bearophile
mixin(caseOnEvent!("SDL_SYSWMEVENT", "syswm"));
default: //has to be there even if empty
static if(is(typeof(that.onOther(Event.init {
that.onOther(polledEvent); break;
}
}
The default should be aligned just like the other cases. Often is
a good idea to use "final switch" with enumerations.
Probably there are ways to make that code more dry, using a
TypeTuple of pairs like ("SDL_QUIT", "quit").
Bye,
bearophile
d like this. My presence around
here is becoming useless.
Bye,
bearophile
interactions and make complexity more manageable. His finding
seems a design mistake.
Bye,
bearophile
Martin Krejcirik:
So, should the case b compile or not ? Is the spec too
restrictive here, or is it a bug ?
Apparently it's a WONTFIX mess. The spec should be updated.
Walter&Andrei refused to fix a design bug here.
Bye,
bearophile
Walter Bright:
On 4/22/2015 2:58 PM, bearophile wrote:
D is less stack-friendly than Ada (and probably Rust too),
??
In Ada standard library you have safe fixed-size stack-allocated
associative arrays. In D you can't even allocate safely a
dynamically-sized 1D array on the stack
don't put everything on the heap. D is less
stack-friendly than Ada (and probably Rust too), but in D you
allocate lot of small stuff on the stack.
Bye,
bearophile
f the video, where he shows an annotation to compile
functions for different CPUs, where the compiler updates function
pointers inside the binary according to the CPU you are using,
making the code safe and efficient.
Bye,
bearophile
better than the aligned() shown here, because I prefer the
alignment to be part of the type), and a way to tell the type
system that some array slices are fully distinct (the __restrict
seen here, I think this information doesn't need to be part of a
type).
Bye,
bearophile
Russel Winder:
it is all part of
guerilla marketing undertaken by anyone with anything to market.
It's still not a correct behavour, regardless how many do it.
Bye,
bearophile
Márcio Martins:
app.put("foo");
app.put(var);
app.put("bar");
I'd like put() to accept a lazy range...
Bye,
bearophile
explicit.
You don't forget to put branches added by the compiler, so it's
safer.
Generally you prefer something that's guaranteed to be allocated
on the stack when it's small and there's enough stack. An array
allocation annotated with "scope", perhaps.
Bye,
bearophile
weaselcat:
It's reddit, that's not really surprising.
Do you know a place better than Reddit for general programming
discussions?
The lambda the ultimate blog is not generic.
Bye,
bearophile
Bye,
bearophile
nough.
They are uncommonly used because they are not supported by the D
compiler, and it doesn't track the memory ownership well enough.
But a well designed system language needs to push programmers to
use the stack as much as possible.
Bye,
bearophile
hink D Zen asks for safety on default and opt-out on request.
See also "@safe by default":
https://issues.dlang.org/show_bug.cgi?id=13838
Bye,
bearophile
Steven Schveighoffer:
What do you think?
I asked for this fix almost five years ago, so I think it's about
time :-)
Bye,
bearophile
deadalnix:
foreach (name; names.parallel) {
name.writeln;
}
no.please
I think "foo.writeln;" is acceptable. You just need to get a bit
used to it.
Bye,
bearophile
linear and not intuitive. As Walter has said at the the start
of this thread, arrays come out as more efficient in a large
number of cases...
Bye,
bearophile
w0rp:
It doesn't amaze me at the moment, as it's slightly faster for
integers, and slightly slower for strings at the moment.
One problem with D strings is that they don't cache their hash
value.
Bye,
bearophile
Vladimir Panteleev:
std.conv doesn't return NaN if you try to convert "banana" to a
double.
I have suggested to add a nothrow function like "maybeTo" that
returns a Nullable result.
Bye,
bearophile
have a lighter std
lib).
Bye,
bearophile
Walter Bright:
I'm not convinced of the need for overloading on 'scope'.
Do you want to explain some of the advantages and disadvantages
of that? It will help understand your reasons.
Bye,
bearophile
,
bearophile
in a
very bug-prone way. Sometimes C++ is a bad example to follow
(like with permutations generations, that currently is not a
Range in Phobos for the wrong reasons).
Bye,
bearophile
perform
some safe integer operations. So is the API very well compatible
with those intrinsics?
Bye,
bearophile
that takes us.
This is interesting. For the final D programmer what's the
practical difference between your proposed subset compared to the
full proposal?
Bye,
bearophile
Andrei Alexandrescu:
Oh boy all classes with one-liner non-final methods. Manu must
be dancing a gig right now :o). -- Andrei
Yes, the right default for D language should be final, because
lot of programmers are lazy and they don't add attributes.
Bye,
bearophile
w0rp:
Every now and then I want a set type,
I think you can implement good enough sets in Phobos, do you
agree?
But you can't do the same with tuples. So I prefer sets in Phobos
and tuples in the language.
Bye,
bearophile
zhmt:
In short words, I want to catch something like
NullPointerException.
Is this possible?
One solution is to add null tests to D in nonrelease mode. A
better solution is to modify D to remove all or most chances of
dereferencing null pointers and class references.
Bye,
bearophile
Jean pierre:
This is a problem, you, the D core has: you're crippled by your
orthodoxism.
Nothing will be added because of this: **rules**.
The current level of acceptance of Phobos patches seems roughly
correct to me.
Bye,
bearophile
Vlad Levenfeld:
Anything going on with this? Been looking forward to seeing it
for awhile.
It will happen.
Bye,
bearophile
Jacob Carlborg:
Although I would like that the D syntax allowed to drop the
curly braces, like with if-satements. That would result
in much nicer one-liner functions.
See:
https://issues.dlang.org/show_bug.cgi?id=7176
Bye,
bearophile
Andrei Alexandrescu:
You may want to answer there, not here. I've also posted a
response.
There is this, with an attach:
https://issues.dlang.org/show_bug.cgi?id=11810
Bye,
bearophile
bad code if you don't keep your eyes and brain switched on.
Bye,
bearophile
ion) is going in the
opposite direction, and for good reasons. An explanation:
https://channel9.msdn.com/Events/GoingNative/2013/Cpp-Seasoning
Bye,
bearophile
Baz:
https://github.com/D-Programming-Language/phobos/pull/3058
I suggest to replace "litteral" with "literal", as in computer
science:
http://en.wikipedia.org/wiki/Literal_%28computer_programming%29
Bye,
bearophile
Andrei Alexandrescu:
That opens the question whether we want only ubyte[] for hex
bytes or all integral types.
I suggest to implement only ubyte[] first. And wait for
enhancement requests.
Bye,
bearophile
Marc Schütz:
Here's the new version of my scope proposal:
http://wiki.dlang.org/User:Schuetzm/scope2
Let's see what Andrei and Walter think about this all :-)
Bye,
bearophile
that wants to
be a little functional. Alternative ways to allocate memory are
needed by some people. The GC needs improvements. Purity is not
yet finished. And there are minor things that can be improved. D3
is not planned, so the only way is to improve D2.
Bye,
bearophile
Andrei Alexandrescu:
hexString and hexBytes. -- Andrei
Can you show me one or two different use cases of hexString?
Bye,
bearophile
ssues.dlang.org/show_bug.cgi?id=5909
Bye,
bearophile
Marc Schütz:
Can we make it so it returns a ubyte[]?
There is an enhancement request on this (for the built in hex
strings).
Bye,
bearophile
Walter Bright:
I'd also prefer to get rid of /+ +/ comments, I thought they'd
be more useful than they are.
I prefer to get rid of /* */ instead :-) Because /++/ can do
things /**/ can't.
Bye,
bearophile
ced to add user-defined error
messages to template constraints, and is such enhancement a good
idea?
Bye,
bearophile
lot, then probably you also like to read a language with
the help of a book.
Bye,
bearophile
pared to Sage.
Bye,
bearophile
Walter Bright:
On 3/13/2015 3:34 AM, bearophile wrote:
"Strict mode" is a D2 with immutable+@safe+pure by default,
Thank you Walter for giving me an actual answer :-)
Note that you can get this largely by starting a module with
the following:
immutable @safe pure:
"i
u for your help.
Bye,
bearophile
Andrei Alexandrescu:
That's a rather random collection - "strict" seems to be "D
without the stuff bearophile dislikes". -- Andrei
I am OK with that definition. Is that your best critique to those
suggestions? :-)
Bye,
bearophile
;d still like built-in tuple syntax in D.
Bye,
bearophile
age; D seems to embody too many ideas at
once
## concurrency?
## networking?
## generics?
## interoperability with C and C++?
## focus on one!
D can't be a single-purpose language. And it has more moving
parts compared to Go.
Bye,
bearophile
some more
reliable code then...
Bye,
bearophile
contain the pointer+length of the dynamic arrays.
Bye,
bearophile
code to work around some of those limitations. And if the design
is good, such islands of unsafety are located inside Phobos
constructs that leak
(http://en.wikipedia.org/wiki/Leaky_abstraction ) very little.
Bye,
bearophile
Walter Bright:
The complexity of a free list doesn't remotely compare to that
of adding an ownership system.
A sound complete ownership system is the only good enough
solution for D. That's my opinion.
Bye,
bearophile
bottomUpMerge(A, i, min(i + width, n), min(i + 2 *
width, n), B);
}
// Now work array B is full of runs of length 2*width.
swap(A, B);
}
}
void main() {
auto a = [3,1,2,5,4,8,6,7,2,9,1,4,3];
a.mergeSort;
a.writeln;
}
Bye,
bearophile
DIP74.
Bye,
bearophile
t was that probably there are even better things that
Kenji can do in part of the time he works on D.
Bye,
bearophile
to reduce
the annotation burden in many cases.
Bye,
bearophile
of D.
Bye,
bearophile
immutable float item = 0.174531f;
r.canFind!q{ feqrel(cast()a, cast()b) >= 21 }(item).writeln;
}
With a recent Phobos bug fix you can now write:
r.canFind!q{ feqrel(a, b) >= 21 }(item).writeln;
Bye,
bearophile
://issues.dlang.org/show_bug.cgi?id=13838
Bye,
bearophile
ers.<
Is this currently enforced in all D compilers?
This DIP allows defining reference counted class objects that
are usable in @safe code. However, it does not enforce safety.<
And do you plan to later design what's needed to enforce their
safety?
Bye,
bearophile
);
immutable float second = (oneDegree * 10.0f);
immutable float step = 0.01f;
immutable float[] r = iota(first, second, step).array;
//r.writeln;
immutable float item = 0.174531f;
r.canFind!q{ feqrel(cast()a, cast()b) >= 21 }(item).writeln;
}
Bye,
bearophile
. I'd like DIP25
removed from D language and replaced by a more principled
solution. Sometimes a heavier solution can be simpler to
understand (and it can be actually safe).
Bye,
bearophile
Andrei Alexandrescu:
using stack-allocated arrays in safe code is a rather niche
use).
I use stack-allocated arrays in supposedly safe code. And having
a future D compiler that makes that kind of code actually safe is
a good thing.
Bye,
bearophile
worth the effort).
Bye,
bearophile
ach(n;stdin.byLine.drop(1))writefln("%.15f",iota(n.to!int).map!"(-1.0)^^a/(2*a+1)".sum);}
You can remove one char:
iota(n.to!int).
n.to!int.iota.
Bye,
bearophile
thout unittests, and few
more basic data points.
Bye,
bearophile
Andrei Alexandrescu:
for an array r, is r.retro contiguous or not?
Is the most useful contiguous range forward? So can you name it
ForwardContiguousRange?
Bye,
bearophile
isions, I hope they
have removed this problem).
Bye,
bearophile
, instead perform an
optimized batch transfer directly to a ContiguousRange via ptr.
Increasing the number of basic ranges will lead to a little more
complexity, but this seems a nice idea.
Bye,
bearophile
Daniel Murphy:
No, they were still O(n) worst case, for a single bucket with a
degenerate binary tree.
I see. I was unable to hit this degenerate case in my testing
code, but I guess that was possible. Thank you.
Bye,
bearophile
;s not too much hard to find and hit that O(n)
case.
Bye,
bearophile
Xinok:
In that respect, it only makes sense for dictionaries
Values as in Python are much more useful for arrays :-)
Meta:
D is better off than Python in this case,
I've never subscribed with point of view :-)
Bye,
bearophile
John Colvin:
tup1.expand.only.countUntil(2).writeln;
Admittedly, it's a little longer than expected :)
A little shorter:
tup1[].only.countUntil(2).writeln;
Bye,
bearophile
H. S. Teoh:
Come to think of it, is there any point in making malloc
@safe/@trusted at all?
I am not asking for a @trusted function. I'd like a @system
template wrapper for malloc/calloc/free that is safer than the C
functions (safer because it's type-aware).
Bye,
bearophile
Andrei Alexandrescu:
Such wrappers would allow safe code to use more C stdlib
primitives.
I'd also like a safer templated wrapper for calloc() and malloc()
and similar.
Bye,
bearophile
bit too much for the average human to handle :-)
Sometimes features help, but that list seems excessive for a
language that is not meant for high integrity systems as D.
Bye,
bearophile
In the best language blog:
http://lambda-the-ultimate.org/node/5113
The discussion is long. They discuss if a good GC can be written
in the language itself, about actual security, what a GC can and
can't do, and more.
Bye,
bearophile
s if* in an 'in' contract. That solves the tooling problem
and the too-much-code problem, no?
Bad idea. We had DbC, let's start using it.
Bye,
bearophile
be in transforming a 5-liner into
a 9-liner?
Contracts can be read by tools, and they are part of the function
signature. Contracts should be encouraged and increased, not
discouraged.
Bye,
bearophile
Andrei Alexandrescu:
http://wiki.dlang.org/DIP25
I'd like a more comprehensive and flexible solution to the
problem of static memory ownership.
Bye,
bearophile
think lot of people is going to write code like that.
And if you are about to suggest this:
alias S = staticArray;
Well, do you like to see aliases in your code?
Bye,
bearophile
s the code bad. Thanks.
Bye,
bearophile
Daniel Kozák:
No, it makes more bugs possible
// this is compile error so its ok
int[MUST_HAVE_FIVE_ITEMS] a=[1,2,3,5];
// Error: mismatched array lengths, 5 and 4
Have you tried to compile my code? It doesn't give an error.
Bye,
bearophile
ecome safer and reduce the work for the GC. I
think only a limited percentage of arrays need to be fully
handled by the GC.
Bye,
bearophile
pport.
Native relational algebra data type.
- An awful lot of data mining and analysis is best done with
relational algebra.
- Not just in the database.
Bye,
bearophile
f you want/need to use numpy, the fourth is good.
No problems :-)
Bye,
bearophile
ortant, because usually there are
multiple ways to do something, but only one of them should be
obvious in Python :-)
Bye,
bearophile
1 - 100 of 7397 matches
Mail list logo