Theoretically legal...
void func()
//in/out contracts
body with (E) { //with replaces normal block
}
This seems sensible. Multiple with seems like a recipe for
confusion and member name clashes.
On 2012-10-17 00:23, Jonathan M Davis wrote:
2. Or make it a range (see http://dlang.org/statement.html#foreach_with_ranges
and http://ddili.org/ders/d.en/ranges.html ), which would probably be a bad
idea, since containers really shouldn't be ranges.
Why is that a bad idea?
--
/Jacob
On Wednesday, October 17, 2012 08:14:45 Jacob Carlborg wrote:
On 2012-10-17 00:23, Jonathan M Davis wrote:
2. Or make it a range (see
http://dlang.org/statement.html#foreach_with_ranges and
http://ddili.org/ders/d.en/ranges.html ), which would probably be a bad
idea, since containers
On 2012-10-17 07:07, Ellery Newcomer wrote:
I am interfacing with some C code [python.dll], which has some structs
declared like so:
PyTypeObject PyType_Type;
I wish to be able to link to PyType_Type like so:
extern(C) __gshared PyTypeObject PyType_Type;
in linux, I can do exactly that, but
On 2012-10-17 08:17, Jonathan M Davis wrote:
For starters, iterating over the container would empty it.
Right, but that is really weird, in my opinion.
--
/Jacob Carlborg
On Tue, 16 Oct 2012 17:52:38 +0100, Benjamin Thaut
c...@benjamin-thaut.de wrote:
Am 16.10.2012 18:38, schrieb Regan Heath: I have some C/C++ code which
handles windows SEH exceptions and can
output (in debug mode) a stack trace, for example:
But, it doesn't output symbol names for the
On 10/16/2012 05:57 PM, Maxim Fomin wrote:
...
At NG discussion it may look nice to define some type and then add
operator overloading methods
Operator overloading is not magic, so your statement can be shortened to
... and then add methods
Which is still not correct, because that is not
On 10/14/2012 09:14 AM, Maxim Fomin wrote:
On Sunday, 14 October 2012 at 07:01:30 UTC, Tommi wrote:
Actually, it seems that alias this has precedence over UFCS. So, a
free function opUnary wouldn't ever suit better than an actual method
opUnary of the thing referred to by that alias this.
On Wednesday, 17 October 2012 at 10:24:57 UTC, Artur Skawina
wrote:
Operator overloading can be abused - that's an obvious and well
known fact. But that
same feature can also be very useful, if used right. Worrying
about UFCS problems in
the context of op-overloading needlessly complicates the
I didn't go through the trouble and find out which version of
dbghelp.dll exactly supports cv debugging symbols, but I know it depends
on that. So I can not help you there.
The linker line looks fine, looks the same for me but works (also with
dmd 2.060)
Did you modify your sc.ini file?
On 10/14/2012 09:01 AM, Maxim Fomin wrote:
On Saturday, 13 October 2012 at 19:50:02 UTC, Timon Gehr wrote:
On 10/13/2012 06:02 PM, Maxim Fomin wrote:
...
Different groups of people have different mind and same things produce
different sense on them. From my point of view operator overloading
On Wednesday, 17 October 2012 at 11:00:05 UTC, Timon Gehr wrote:
On 10/16/2012 05:57 PM, Maxim Fomin wrote:
...
At NG discussion it may look nice to define some type and then
add
operator overloading methods
Operator overloading is not magic, so your statement can be
shortened to
...
On 2012-10-17 17:45, Jonathan M Davis wrote:
Well, what would you expect? Ranges are consumed when you iterate over them.
So, if an container is a range, it will be consumed when you iterate over it.
That's the way that it _has_ to work given how ranges work, and that's why you
overload opSlice
On Wed, Oct 17, 2012 at 06:58:52PM +0200, Jacob Carlborg wrote:
On 2012-10-17 17:45, Jonathan M Davis wrote:
Well, what would you expect? Ranges are consumed when you iterate
over them. So, if an container is a range, it will be consumed when
you iterate over it. That's the way that it
On 10/17/2012 09:58 AM, Jacob Carlborg wrote:
On 2012-10-17 17:45, Jonathan M Davis wrote:
Well, what would you expect? Ranges are consumed when you iterate over
them.
So, if an container is a range, it will be consumed when you iterate
over it.
That's the way that it _has_ to work given
I could make my marshaller/unmarshaller only update objects in
place. I think this is more useful and would remove the overlap
between orange and the JSON library. We could then write a JSON
archiver for orange and include it in std.json as well.
The call to unmarshal would look like:
bool
On Wednesday, October 17, 2012 10:08:15 H. S. Teoh wrote:
On Wed, Oct 17, 2012 at 06:58:52PM +0200, Jacob Carlborg wrote:
On 2012-10-17 17:45, Jonathan M Davis wrote:
Well, what would you expect? Ranges are consumed when you iterate
over them. So, if an container is a range, it will be
You have mentioned needing an allMembers that excluded
functions in one of your other posts. The following thread was
exactly about that. I can never remember the solution, but I
found it again: :)
On Mon, Oct 15, 2012 at 5:52 PM, Andrei Alexandrescu
seewebsiteforem...@erdani.org wrote:
I wanted to investigate small sorts using sorting networks for ages, but
never got around to it. That's important for quicksort because it produces
many small arrays that need sorting.
Could you also
I tryed to learn how arrays works and found another strange thing:
import std.stdio;
int[] create()
{
int[5] a1 = [ 10, 20, 30, 40, 50 ];
int[] b1 = a1;
writeln(b1: , b1);
return b1;
}
void main()
{
int[] a2 = create();
writeln(a2: , a2);
}
On 2012-10-17, 21:17, m0rph wrote:
I tryed to learn how arrays works and found another strange thing:
import std.stdio;
int[] create()
{
int[5] a1 = [ 10, 20, 30, 40, 50 ];
int[] b1 = a1;
writeln(b1: , b1);
return b1;
}
void main()
{
int[] a2 =
On Wednesday, 17 October 2012 at 19:22:05 UTC, Simen Kjaeraas
wrote:
On 2012-10-17, 21:17, m0rph wrote:
I tryed to learn how arrays works and found another strange
thing:
import std.stdio;
int[] create()
{
int[5] a1 = [ 10, 20, 30, 40, 50 ];
int[] b1 = a1;
Here's the updated code. It's got a marshaller and unmarshaller:
https://gist.github.com/3894337
It's about 650 lines. If you have time, I'd be very interested in
getting some feedback (or from anyone else who sees this post of
course).
The main problem I'm having right now is that
b1 points to the exact same data as does a1. This data is stack-
allocated, and thus a2 points to an overwritten stack frame.
Thanks for explanation, I thought contetns of a1 are copied to
the heap when assignment operator executed.
sclytrack:
It doesn't give an error when marking the function with safe.
@safe
int[] create()
{
}
I think marking it @safe is not relevant. In theory a good type
system should give an error message on similar code. I don't know
if D is supposed to spot similar error situations.
Bye,
On Tuesday, 16 October 2012 at 06:37:55 UTC, Jacob Carlborg wrote:
The goal of Orange was to be able serialize basically
everything found in D.
Can it serialize Variant?
On Wednesday, October 17, 2012 21:46:50 bearophile wrote:
sclytrack:
It doesn't give an error when marking the function with safe.
@safe
int[] create()
{
}
I think marking it @safe is not relevant. In theory a good type
system should give an error message on similar code. I don't
On Wednesday, 17 October 2012 at 19:46:51 UTC, bearophile wrote:
sclytrack:
It doesn't give an error when marking the function with safe.
@safe
int[] create()
{
}
I think marking it @safe is not relevant. In theory a good type
system should give an error message on similar code. I don't
On 10/17/12 12:46, Timon Gehr wrote:
On 10/15/2012 01:00 PM, Artur Skawina wrote:
...
An overloaded operator is just another normal method; you get the same type
of
problems when dealing with normal methods - eg in types having an alias
this -
an UFCS method must take precedence over
Jonathan M Davis:
there's no way for the compiler to always catch it for you.
I think there are type systems able to always catch this kind of
bug (conservative region analysis, it means that if it can't
demonstrate the memory doesn't escape, it prudently refuses the
code). D doesn't have
The only way that @safe could really be applicable would be if
it became @system to take the address of a local variable or to
slice a static array. And perhaps it should be, but that and
catching the most obvious cases are all that the compiler could
do to catch this for you.
Hmmm, you
On Wednesday, October 17, 2012 13:07:13 Jonathan M Davis wrote:
The only way that @safe could really be applicable would be if it became
@system to take the address of a local variable or to slice a static array.
And perhaps it should be, but that and catching the most obvious cases are
all
1. Define opApply (see section labeled Foreach over Structs
and Classes with
opApply after here:
http://dlang.org/statement.html#foreach_with_ranges)
2. Or make it a range (see
http://dlang.org/statement.html#foreach_with_ranges
and http://ddili.org/ders/d.en/ranges.html ), which would
On 10/17/2012 10:15 PM, sclytrack wrote:
On Wednesday, 17 October 2012 at 19:46:51 UTC, bearophile wrote:
sclytrack:
It doesn't give an error when marking the function with safe.
@safe
int[] create()
{
}
I think marking it @safe is not relevant. In theory a good type system
should give an
On Wednesday, 17 October 2012 at 19:44:47 UTC, Tyler Jameson
Little wrote:
The main problem I'm having right now is that classes/structs
have to be static.
That seems weird, I've done something similar with non-static
structs before.
Maybe it will help if you use __traits(getMember, obj,
On 10/17/12 3:07 PM, Philippe Sigaud wrote:
On Mon, Oct 15, 2012 at 5:52 PM, Andrei Alexandrescu
seewebsiteforem...@erdani.org wrote:
I wanted to investigate small sorts using sorting networks for ages, but
never got around to it. That's important for quicksort because it produces
many small
Is there an equivalent to std.range.chunks that will work on a
char array? As in, it will return a range iterating over chunks
of code points?
On Thursday, October 18, 2012 01:19:02 cal wrote:
Is there an equivalent to std.range.chunks that will work on a
char array? As in, it will return a range iterating over chunks
of code points?
Not that I'm aware of (though there _may_ be a function that you could do it
with that I'm not
I want the function below to run independently -- like a unix
background process, without delaying subsequent code in main. I
tried the following using std.parallelism:
void main() {
function_a(int a, int b) {
...
}
auto new_task = task!function_a(11, 12);
On 10/16/2012 11:16 PM, Jacob Carlborg wrote:
You need to declare the variable as extern if it's defined in the C code:
extern(C) extern __gshared PyTypeObject PyType_Type;
http://dlang.org/interfaceToC.html#C%20Globals
nice tip, but adding extern doesn't change link behavior at all.
40 matches
Mail list logo