in the download page there is no dmd-2.052 version for rpm package manager
So I continued my quest to remove the SNN.lib dependency (and instead depend on
MSVCRT.dll), and ran into a Heisenbug that I think might relate to TLS.
Basically, the bug shows up only if Visual Studio isn't attached to the program,
and it only happens when the program is exiting. (!)
Would
I know some people don't like using mixins, but I think that's
really the best way to achieve that effect without loosing DIY and
without resorting to something more heavy-weight
...
That just gave me an idea: I think you should be able to get away
with an ordinary union
I thought about those,
Actually, on a second thought, I just noticed that the union method
*is* extensible, since you're putting things in different unions... I
think I'll give it a shot, thanks! :)
What exactly is it that you're trying to do?
(1) I'm not going to create a new instance of an entire class
every single time I need to check an access mask, that's wasteful.
I meant, you write File.open or File.isReadable which do the job
for you and don't expose OS cruft.
That's what I'm
Anyway, at some point I realized that I cannot understand what is going on
because there is some language mechanism in action
which I do not know.
Fuck no! precise definition of tuples is something that always makes me
really grumpy. Do we want a incomprehensible ivory tower
language or
As long as you expose OS cruft, your wrappers are useless, I'm
afraid.
I suggest you to provide safe and meaningful wrappers, e.g.
streams, ranges, for concrete business cases which deal with OS
directly so that the wrapper won't need flags from user (they are
usually encoded in the function
Lol, okay. Do you have any other suggestions for a better
solution on how to avoid duplicating generic access masks like
MAXIMUM_ALLOWED inside each access mask type?
You're doing it wrong. Create OO wrapper instead.
Hm... but:
(1) I'm not going to create a new instance of an entire class
I thought @safe was orthogonal to pure? If this isn't the case,
then yes, free must be disallowed. But then malloc must also be,
and any construct which manages its own memory via malloc/free.
From what I remember, pure functions:
1. cannot access shared or global non-immutable data
2.
It seems that you're using the word pure as a synonym for the noalias
and/or restrict __declspec keywords. However, they're different words
because they have
different meanings. :) If you really mean noalias, then I think we just just
call it that and introduce the attribute @noalias?
Programmers are allowed to make conceptually safe functions which
are not marked as @safe, why not the same for pure functions?
Programmers can always shoot themselves in the foot anyway, if they
really want to. Why not just make it easier for them? :) (We could
allow unsafe casts, for
Because a pure unsafe function is useless.
I disagree. Suppose you have a function which is conceptually pure but
requires a temporary 100
Mb matrix of doubles. Wouldn't it make sense to use malloc/free for this
temporary storage
instead of using the GC and risking the block never being
No. pure is what we want. Changing it would break code and contradict TDPL
(though the
addition of weakly pure isn't in TDPL). Strongly pure functions are essentially
what you'd
expect from pure. Weakly pure functions aren't, but they're necessary to make
pure very
useful, and there's no real
I have a question on enum inheritance -- I'm wondering if what's happening
below is a bug or by
design?
I have code like this:
enum AccessMask { GenericRead = 0x8000 }
enum FileAccess : AccessMask { ReadData = 1 } //Errors
void foo(FileAccess a) { /*Do something*/ }
void bar() {
enum AccessMask { GenericRead = 0x8000 }
enum FileAccess : AccessMask { ReadData = 1 } //Errors
Nice. Has Walter thought about the possibility of such D code? Similar
problems with typedef
(that doesn't play well with OOP) have pushed Andrei to remove typedef from D.
So be careful,
or
Hi everyone,
Was hoping someone could help me make sense of this bit of C++ code:
class canvas
{
operator HDC() { return _hdc; }
protected:
canvas(HDC hdc): _hdc(hdc) {}
HDC _hdc;
}
From what I understand, HDC is an alias for HANDLE in Windows. So
they are overloading canvas such
Thaks to everyone for your assistance.
bearophile,
You do have a point there, and I actually expected that response.
I would have posted my attempt at implementation, but am unable to
transfer info between the computer I'm typing this message on and
the one I'm programming on at the moment.
I have no problems converting small
I'm really glad that this issue is being looked into. I've literally wasted
days (if not a few weeks) getting
another to work instead of SNN.lib, and I think that the ultimate culprit that
prevented things from working was
_xi_a.
What steps did you take?
btw, I opened
Having learned functional programming in Scheme a couple months ago, I tried my
hand at using map(), reduce(), and filter() in D:
int addend = 5;
map(delegate int(int x) { return x + addend; }, iota(1, 5));
but it didn't work. It turned out that map() actually took the mapper as its
Indeed. The solution to OP's problem is std.algorithm.map. Local
instantiation should take care of aliases that refer to local
symbols, so OP's original complaint about std.algorithm.map is
invalid (albeit for a subtle reason). The following code compiles as
expected:
import std.algorithm,
Well, the trouble is, pretty much all of these are invalid
attributes:
- static obviously makes no sense
And here is where you're wrong. You have defined a static
destructor, which is called with module destructor as the program
goes out of scope, rather than when your struct or class is
What does _xi_a even do? Is it anything more than just a marker
inside the executable?
have you seen this page:
http://wiki.osdev.org/C_PlusPlus#Visual_C.2B.2B ?
I think dmc is pretty much in line with it. You can also find these
sections in the map files generated when compiling a D file
What's the problem with a pure destructor? It only means you can't access
global variables.
If the object holds a pointer to somewhere, you can still affect that somewhere.
In fact, if your struct's destructor isn't pure, how can you use it as local
variable inside
of a pure function?
The
I just visited Wikipedia (savior of the day) and a quick look at
this article:
http://en.wikipedia.org/wiki/Pure_function
yields the following requirements for a pure function:
1. The function always evaluates the same result value given the
same argument value(s). The function result value
D pure functions are significantly different than this definition
(as of recent times, when weak-pure was added).
Essentially, a pure function cannot access global variables.
However, it can access variables referred to via a member of the
object instance.
i.e. this is a valid pure function:
- private makes no sense since (unless we're trying to imitate C++ here)
destructors are only called from
the runtime, and nowhere else.
- The only meaningful attribute there is extern(C).
In what way is extern(C) meaningful for a destructor?
I guess it would be logical to specify that, if
Hi,
I'm just curious... why is saying something like this:
extern(C)
private static const pure override final synchronized ~this() { }
allowed?
Thanks!
That's pretty good. Almost all of those things are standard C.
LDIV and UDIV could easily be eliminated.
__except_list is a null asm label (it is FS:[0]).
So the main problematic ones are:
_xi_a , __acrtused_con, the __fp functions, and _Ccmp
So how to tackle that?
I'm really glad that
remove takes a range type which is the range type for the
container that it's on. That makes sense. It's obviously not going
to be able to a take an arbitrary range and remove that from itself.
How would it know which elements in that range corresponded to which
elements in itself - especially
The more I look at it, the more I'm convinced that we really need to
add a primitive to forward ranges that returns the first n elements of
that range. Without that, I don't see how you can get a range of the
correct type with only those elements in it unless it's also a
bidirectional range,
You know, I'm actually now questioning whether STL did the right thing
with requiring iterators for the erase() method. It actually seems
quite pointless -- there's no reason why integer indices wouldn't
work. I don't think we really need to follow suit with STL here... is
there some situation
dmd is pretty lax about attributes which don't apply. It generally just
ignores them. Personally,
I think that it should error on invalid attributes, but for some reason, that's
not how it works.
Of course, there could be other bugs in play here, but there's every
possibility that the end
Hm... so the entire issue here seems to be the capability to do
iteration and modification in a concurrent manner, right?
IMHO that may not be worth the costs we're paying -- I would argue
that you normally shouldn't be modifying a collection that you're
iterating over in the first place; it just
== Quote from bearophile (bearophileh...@lycos.com)'s article
Timings, n = 100_000_000, seconds, best of 6:
Xorshift: 1.08
MinstdRand: 1.15
Mt19937:1.92
DMD 2.052. It seems that compared to MinstdRand, Xorshift is both faster and
gives higher quality outputs :-)
import std.stdio,
-free because the parser
would have to rely on the semantics of 'U' to determine how to parse
it.
Ahh that makes sense. Thank you for the great explanation! :)
Andrej Mitrovic Wrote:
On 2/12/11, Walter Bright newshou...@digitalmars.com wrote:
Andrej Mitrovic wrote:
Great, from one closed-source linker to another.
Making optlink open source won't make any difference. Few are skilled at asm
anymore, and likely none of them would want to work on
Hi,
I think I'm having a little trouble understanding what's meant by context-free
grammar. I've read that D is context-free, but is it really? What about an
expression like:
int[U] s;
? You can't tell -- without looking at the context -- whether U is a data type
or a number, and so because
That will always parse to an associative array. Then in the semantic pass, if
U
is a constant expression that turns out to be an integer it is reinterpreted as
a
static array.
Ah, interesting. But that describes the implementation (i.e. how the compiler
copes with the ambiguity
Please pardon my complete lack of knowledge. Please provide some
suggestions/pointers so that I can improve myself.
Given a table containing three values (ie, myName, myId, parentId),
how does one insert those values into a tree such that the
parent/child relationship defined in the table is
Hello,
I've a problem with my class inheritance. I have class called Texture
which implements the interface IDrawable and the abstract class
APickable.
The Texture-class contains 3 members which looks like this:
GLuint pTextureID;
Size pSize1, pSize2;
Finally... my Texture-class looks like:
== Auszug aus Steven Schveighoffer (schvei...@yahoo.com)'s Artikel
On Fri, 11 Feb 2011 15:40:18 -0500, %u unkn...@unknown.com wrote:
Hello,
I've a problem with my class inheritance. I have class called
Texture
which implements the interface IDrawable and the abstract class
APickable
== Auszug aus bearophile (bearophileh...@lycos.com)'s Artikel
Steven Schveighoffer:
Any code can access any members defined in the current module,
regardless
of access attributes
I am not sure if Walter understands how much this rule makes it
hard for people not already used to
== Auszug aus Andrej Mitrovic (andrej.mitrov...@gmail.com)'s Artikel
On 2/11/11, bearophile bearophileh...@lycos.com wrote:
Steven Schveighoffer:
Any code can access any members defined in the current module,
regardless
of access attributes
I am not sure if Walter understands how
What Phobos modules are currently depreciated or undergoing mayor
changes right now? And what are their replacements if any?
I suppose std.xml is one. What about std.regex/std.regexp,
std.stream/std.stdio/std.cstream/std.socketstream, std.bind,
std.boxer/std.variant?
BTW:
== Quote from bearophile (bearophileh...@lycos.com)'s article
D is currently very not-orthogonal.
I think you might the person to ask this:
I've seen the concept of orthogonality pop up more and more and it was
especially
prominent in the awkward Go vs D reddit discussion, can you maybe explain
== Quote from bearophile (bearophileh...@lycos.com)'s article
%u:
can you maybe explain what it exactly means?
And, also how it relates to your enhancement?
In programming languages it means features that have fully separated purposes,
that can be combined together in clean and safe ways
Hi
excuse my ignorance
what does that term mean?
and what the different b/w learning D pobos
It will be fixed at some point, but it hasn't been yet.
Oh cool, all right; thanks!
Hi,
I was wondering, why are we allowed to omit parentheses when calling functions
with no arguments, when they are not @properties? Is there a good reason for
relaxing the language rules like this?
Thanks!
== Quote from Steven Schveighoffer (schvei...@yahoo.com)'s article
I hate to fuel this any further, but I want to re-iterate what I have
learned. Please re-read my summary (titled SHOO's Time code --
conclusion) in the announce group.
I personally went through great lengths to satisfy 1. It
== Quote from Jonathan M Davis (jmdavisp...@gmx.com)'s article
On Thursday, February 03, 2011 15:51:10 %u wrote:
== Quote from Steven Schveighoffer (schvei...@yahoo.com)'s article
I hate to fuel this any further, but I want to re-iterate what I have
learned. Please re-read my summary
I know is possible to create an object from its name. It's possible to
call a method from that object if the name is only known at runtime?
Would something like the following be possible?
string classname, methodname;
// Ask the user for class and method.
auto obj = Object.factory(classname);
When implemented, will uniform call syntax work for the this
object even if not specified?
For example, will foo() get called in the following example?
void foo(A a, int b) {}
class A {
void test() {
this.foo(10);
foo(10);
}
}
Thanks
Hi,
I was wondering, is there any particular reason why critical.c and monitor.c
aren't written in D?
I've attached the D versions...
Please add as a patch to bug 4332.
Cool, I added the attachments!
(I have no idea how to use git, or if I have the upload permissions (probably
not), so I
Please add as a patch to bug 4332.
Cool, I added the attachments!
On a second thought, this is a bit trickier than I'd thought, since it's not
working without additional modifications that I at first thought were
unnecessary.
Did the C version run any sort of static constructors during the
Hi,
I just realized something: If the delete keyword is being removed because it's
dangerous, and if the scope storage class is being removed because of the same
dangling reference problem, how come
int[] global_var;
void foo(int[] args...) { global_var = args; }
isn't considered to be
Hi,
I've tried to compile programs and Phobos without deprecated features on, and
yet I've come across a problem:
Volatile statements are deprecated.
So, for example, in thread.switchOut(), these statements are invalid:
volatile tobj.m_lock = true;
fiber_switchContext( oldp, newp );
(')E9F5R96YC92!I;B!/
M8FIE8W0@]I;G1S('1O#0IS=')U8W0@36]N:71O@T*PT*(`@('9O:60J
M(!I;7!L.R`O+R!F;W(@=7-EBUL979E;!M;VYI=]RPT*(`@($%RF%Y
M(!D979T.R`O+R!F;W(@:6YT97)N86P@;6]N:71OG,-B`@(!S:7IE7W0@
MF5FSL@+R\@F5F97)E;F-E(-O=6YT#0H@(`@0U))5$E#04Q?4T5#5$E/
M3B!M;VX[#0I].PT*#0IA=71O($U/3E!44BA/8FIE8W0@:D@R!R971UFX@
M
Oh shoot, I had no idea it would turn out like that, sorry. (It didn't do that
on
the site so I really didn't expect it.) Thanks for letting me know.
Is this a bug?
__gshared static i;
makes i be thread-local, while
static __gshared i;
makes it be shared.
Are there plans for including a double linked list in phobos? Maybe
one backed by an array like .NET's ListT or Java's ArrayList.
If so, when?
Thanks
How do I get dmd's memory usage a few hundred MBs down?
I keep having to close everything in order not to get an out of memory error
while compiling (-w -full).
I'd like to get it from 700-800 to below 400 :)
Any way to inspect which part is the biggest drain?
Er, bit exaggerated..
450 to below 300 pls :)
== Quote from Robert Clipsham (rob...@octarineparrot.com)'s article
CTFE and templates will use up the most memory - particularly if you use
a lot of strings, as the memory allocated is never freed. You can work
around it be compiling files one at a time or a few at a time, so
instead of:
$
I don't know what that abbreviation means.
Haha I kind of made that up... just meant My Mileage *Will* Vary :)
Huh, I never noticed the keyword conflict; that's totally legitimate, although
personally I'd prefer PascalCased. But I don't like the related to the
language
idea; it shouldn't be
I wanted to suggest a feature similar to inout: conditional purity. That is,
sometimes a function is pure iff the delegates passed to it are pure, and as
of right now, I don't think there's any way to document this other than by
overloading the function as a template (which results in lots of code
I think this is useless. If this is possible, then you just mark every single
not-pure function in the program with @conditionally_pure, and we are back to
the
beginning.
Oh, but that's not what I meant! I meant something like this:
int call(TFn)(TFn fn) pure(isPure!(TFn))
if
I see. I'd like a more general-purpose solution, something that works with
nothrow too and other future attributes too.
Funny, that was going to be my next comment. :)
The only thing that scares me a bit is that code like this:
public(isPublic!(TFn)) static(isStatic!(TFn)) int memoize(TFn)(TFn
Any ideas on how we might be able to get that to work?
@optional_tag(is(T == int) || is(T == long)), const)
Ouch... a bit less pretty than I'd hoped (the underscore makes it a bit ugly
IMHO). Does it really need to be a tag, though? Why not just:
optional(const, is(T == int) || is(T ==
In theory this has to be enough: typeof(F) F2;
But in practice, I want to change the body of my function, or possibly add new
parameters in the beginning or the end. Does this let me do either of these?
Thank you!
Is this what you're looking for?:
No. :)
(Though you already found this out at the end!)
I was looking for some way to keep the storage classes and any other (meta)data
about the parameters that may be added in the future to the library. I have a
feeling this might be a very big change in how
The ugly solution would be to do this:
void test (ref int a) { }
void main () { writeln(typeof(test).stringof); }
Which will print: void function(ref int a) and then parse out what you need.
If you're referring to using mixin() to parse the signature, I've already
thought
of that, but it
ref(const(immutable(string)[])) ?
That's crazy!
Did you mean ref(const(immutable(char)[]))?? :]
Haha... well it was just an idea on how to add the functionality, and like I
mentioned, even if it was fine for 'ref' and 'lazy', it wouldn't make any sense
for 'out' anyway, so I'd say screw my
That would be bug 3516, wouldn't it?
Huh... yes, it indeed would. Thanks for the link, I couldn't think of the right
keywords to search for. :)
I find it very hard to believe that struct dtors are never called.
Sorry, that part was my bad -- last time I checked, they didn't get called, but
maybe my example was too complicated, since they did get called for a *simple*
example.
However, here's a situation in which no postblit or
Hey guys,
I'm trying to connect to my mysql-server on windows. I'm using the mysql
binding from http://www.steinmole.de/d/ because as I know the
DDBI project doesn't support D2.
I followed the instructions on the site and first created the lib file with
implib with the following command: implib
Hi,
Something has been confusing me, regarding passing around aliases of instance
members.
If I can say:
struct S { int m; }
pragma(msg, (S).m);
How come I can't say:
struct S { int m; }
pragma(msg, __traits(getMember, S, m));
?
What's the difference, and what does each one mean?
Sorry, I just noticed a typo. The line saying
pragma(msg, __traits(getMember, S, m));
should've said:
pragma(msg, __traits(getMember, S, m));
What you really want is for IFTI to strip down const/immutable on arrays and
basic types. I think it's a bugzilla bug somewhere, if not it's definitely been
discussed on the phobos mailing list.
Ah, all right then, nice!
Since 2.041, this cannot happen. A resize of a slice where data will
Didn't look at your code exactly, but from reading this discussion, what you
have implemented is basically a memory pool ;)
Huh, interesting... I didn't think about it that way, but in a way, that's true.
:) I just thought of it as some tree representation that did not use pointers.
Yes it's
Hi,
I've noticed that some functions, such as algorithm.endsWith, don't work with
constant arrays. Is this a bug, or is there a reason behind it? It forces the
user to perform dangerous casts to avoid object creation, and it doesn't seem
like the functions actually need to perform any
@=AIRYG9712:6=H
M=AN;V1E*3L@=5M`A/2!N=6QL.R!T96UP(#T@=AIRYG971,969T*'1E
M;7`I*0T*0D)7L-@D)0D)W1A8VL@?CT@=5M`A/2!N=6QL(#\@)G1H
M:7,N:71E;7-;=5MYS96QF72`Z(YU;P[#0H)0D)?0T*0D)7)EW5L
M=`](1G*YO94I.PT*0D)6EF(AR97-U;'0I('L@8G)E86L[('T-@D)
M7T-@D)?0T*0ER971UFX@F5S=6QT.PT*7T-GT-@T*86QI87,@07)R
M87E:6YAGE4F5E(2AI;G0I
Regardless, a fully const array is never going to work with a function like
endsWith() for the simple reason that such functions have to actually be able to
process the range that they're given, and if the range is const, you can't call
popFront() or popBack() on it, so it just isn't going to
The unsorted binary tree you mention doesn't sound right. Such a
container would need to be kept sorted.
It would, IF it was implemented the same way as a heap. But it's not. Take a
look
at my implementation if you get the chance; every node has four members in
addition to the value, which are
== Quote from Don (nos...@nospam.com)'s article
It's in a switch statement somewhere.
It sounds as though this is a bug which involves multiple files, so
it'll be difficult to reduce it.
If you're able to compile DMD, change this line in statement.c line 2620:
Statement
== Quote from Don (nos...@nospam.com)'s article
Yay for first time compiling dmd :)
Sorry you had to do that!
Had to learn that once anyway :)
Maybe I'll even be able to take a stab at fixing bugs someday..
Hi,
Is there any way to specify a parameter as something that can be called with
parameter types A, B, C and that returns a value of type D, without caring
whether it's a delegate, a function, or an object that overloads opCall? (This
might require the use of templates, but I still can't figure
is it available?
I only need something to make a void deleg() from a void func().
== Quote from Stanislav Blinov (bli...@loniir.ru)'s article
In C++ I sometimes have similar problems, especially with multiple
inheritance. Though, as Jonathan mentioned, those problems are even more
annoying because of hijacking: you don't always immediately notice them.
Long ago I've decided
Should I post it as a bug, even though I have no code to accompany it?
I have no clue as to where to start my directed search for a minimal case.
== Quote from Simen kjaeraas (simen.kja...@gmail.com)'s article
%u e...@ee.com wrote:
I only need something to make a void deleg() from a void func().
This works for me:
ReturnType!( F ) delegate( ParameterTypeTuple!( F ) ) toDelegate( F )( F
fn ) {
return ( ParameterTypeTuple!( F
== Quote from Don (nos...@nospam.com)'s article
%u wrote:
Should I post it as a bug, even though I have no code to accompany it?
I have no clue as to where to start my directed search for a minimal case.
Can you post the entire source code?
It's important that it be reproducible. It doesn't
Sorry to bump this up, but is RefCounted(T) really leaking, or am I missing
something? I would like to use this in my program, and I'm curious as to why no
one responded, since if it's actually leaking, it would be an important issue.
Thanks!
== Quote from bearophile (bearophileh...@lycos.com)'s article
%u:
func(cast(I2)(new C()));
That code smells a bit (http://en.wikipedia.org/wiki/Code_smell ).
Bye,
bearophile
Extract the construction and you get:
module main;
interface I1{}
interface I2 : I1{}
class C : I2
What method are you using to test the memory?
I'm puzzled that you've put a comment there rather than the code you're
actually
using.
I'm not using code, I'm checking the working set of my process in Task Manager,
and through every iteration, it adds 128 MB.
If you run this code twice,
== Quote from Jonathan M Davis (jmdavisp...@gmx.com)'s article
On Saturday 08 January 2011 22:01:11 %u wrote:
Isn't it possible to have a hierarchy in interface definitions such that it
is possible to overload according to best interface match?
This now won't compile due to multiple
It assumes everything on the stack is pointers, at the moment, I believe
Uh-oh... not the answer I wanted to hear, but I was half-expecting this.
So doesn't that mean that, at the moment, D will leak memory?
If it's not on the garbage collected heap, it won't scan it unless you
tell it to.
Kinda sorta. I haven't had any problems from that. If you allocate very large
blocks in the garbage collector you may face trouble :-)
Haha okay, thanks. :) (This makes me shiver quite a bit...)
You have to add it to the garbage collector's list of roots
But if I need to do that, then what
101 - 200 of 307 matches
Mail list logo