Re: runtime vararg can easily be broken

2009-06-12 Thread davidl
在 Sat, 13 Jun 2009 02:17:03 +0800,Daniel Keep 写道: davidl wrote: The runtime vararg push into stack with align of 4, however programmer might neglect this easily and cause problem. ... That's because you're not supposed to do that. std.stdarg Then you probably want to accuse the spec

Re: runtime vararg can easily be broken

2009-06-12 Thread grauzone
Daniel Keep wrote: davidl wrote: The runtime vararg push into stack with align of 4, however programmer might neglect this easily and cause problem. ... That's because you're not supposed to do that. std.stdarg Contains only a template. Here's the solution (untested): void* va_arg(inout

Re: why implicitly allowing compare ubyte and byte sucks

2009-06-12 Thread Rainer Deyke
Don wrote: > That's true. What you are doing is removing the int/byte inconsistency, > by making uint == int comparisons behave the same way that ubyte == > byte comparisons do now. > Notice that your proposal > (1) preserves the existing behaviour of byte==ubyte (which the original > poster was c

Re: runtime vararg can easily be broken

2009-06-12 Thread Daniel Keep
davidl wrote: > The runtime vararg push into stack with align of 4, however programmer > might neglect this easily and cause problem. > > ... > That's because you're not supposed to do that. std.stdarg

Re: runtime vararg can easily be broken

2009-06-12 Thread Robert Fraser
davidl wrote: Also the whole paradigm of coding a runtime vararg func is so troublesome and even much complex compared to the compile time vararg. Maybe we should borrow something from compiletime to aid the runtime vararg programming. Got my vote!

Re: __FUNCTION__ implemented with mixins and mangles

2009-06-12 Thread Robert Fraser
Jarrett Billingsley wrote: It's not foolproof, but I found it useful enough; maybe others will too. // Parsing mangles for fun and profit. char[] _getJustName(char[] mangle) { size_t idx = 1; size_t start = idx; size_t len = 0; while(idx < mangle.length && mangle[idx] >= '0' &&

Re: __FUNCTION__ implemented with mixins and mangles

2009-06-12 Thread Jarrett Billingsley
2009/6/12 davidl : > 在 Sat, 13 Jun 2009 00:40:09 +0800,Jarrett Billingsley > 写道: > >> It's not foolproof, but I found it useful enough; maybe others will too. >> >> // Parsing mangles for fun and profit. >> char[] _getJustName(char[] mangle) >> { >>size_t idx = 1; >>size_t start = idx; >>

Re: __FUNCTION__ implemented with mixins and mangles

2009-06-12 Thread davidl
在 Sat, 13 Jun 2009 00:40:09 +0800,Jarrett Billingsley 写道: It's not foolproof, but I found it useful enough; maybe others will too. // Parsing mangles for fun and profit. char[] _getJustName(char[] mangle) { size_t idx = 1; size_t start = idx; size_t len = 0; while(idx < mang

runtime vararg can easily be broken

2009-06-12 Thread davidl
The runtime vararg push into stack with align of 4, however programmer might neglect this easily and cause problem. import std.boxer; import std.stdio; void func(...) { Box[] arguments; arguments.length = _arguments.length; for(int i;i<_arguments.length;i++) { arguments[i] = box(_a

__FUNCTION__ implemented with mixins and mangles

2009-06-12 Thread Jarrett Billingsley
It's not foolproof, but I found it useful enough; maybe others will too. // Parsing mangles for fun and profit. char[] _getJustName(char[] mangle) { size_t idx = 1; size_t start = idx; size_t len = 0; while(idx < mangle.length && mangle[idx] >= '0' && mangle[idx] <= '9')

Re: Functional programming, immutablility

2009-06-12 Thread Sean Kelly
bearophile wrote: D2 language already has many of those features, monads can be implemented (even if the language doesn't offer syntax to manage them). Pattern Matching is missing (but this isn't too much bad: adding pattern matching to D2 may increase its complexity a bit too much). I think

Re: Count your blessings!

2009-06-12 Thread Michel Fortin
On 2009-06-10 20:14:25 -0400, Andrei Alexandrescu said: Michel Fortin wrote: On 2009-06-10 17:38:55 -0400, Andrei Alexandrescu said: * there is nothing to improve threads, further demotivating support for Deadlock-Oriented Programming (DOP) in D On the contrary. I believe they're doing