[Issue 5411] import wtf1
http://d.puremagic.com/issues/show_bug.cgi?id=5411 Walter Bright bugzi...@digitalmars.com changed: What|Removed |Added Status|NEW |RESOLVED CC||bugzi...@digitalmars.com Resolution||INVALID --- Comment #1 from Walter Bright bugzi...@digitalmars.com 2011-01-05 00:15:42 PST --- The selective imports only apply to std.algorithm, not std.stdio. std.algorithm publicly imports std.stdio, and so the selective import of writeln from std.algorithm works. The behavior is as expected. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 5411] import wtf1
http://d.puremagic.com/issues/show_bug.cgi?id=5411 Andrei Alexandrescu and...@metalanguage.com changed: What|Removed |Added Status|RESOLVED|REOPENED CC||and...@metalanguage.com Resolution|INVALID | --- Comment #2 from Andrei Alexandrescu and...@metalanguage.com 2011-01-05 00:18:55 PST --- std.algorithm imports std.stdio privately. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 5130] writeln cannot take delegate
http://d.puremagic.com/issues/show_bug.cgi?id=5130 --- Comment #2 from SHOO zan77...@nifty.com 2011-01-05 07:00:52 PST --- (In reply to comment #1) I wonder if printing the type of the delegate is the smartest thing to do. After all one can always print typeid(...) if that's what's needed. I think so, too. However, there is a problem in Tuple. Because Tuple struct was not able to receive delegate for toString function, I made it printable as first aid. As well as Tuple, a problem may occur. Range, container, assert message... It may be that you had better offer the default print method to support the generic programming. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 5413] New: (diagnostic): No notification that warnings are treated as errors
http://d.puremagic.com/issues/show_bug.cgi?id=5413 Summary: (diagnostic): No notification that warnings are treated as errors Product: D Version: D1 D2 Platform: All OS/Version: All Status: NEW Severity: normal Priority: P2 Component: DMD AssignedTo: nob...@puremagic.com ReportedBy: ibuc...@ubuntu.com --- Comment #0 from Iain Buclaw ibuc...@ubuntu.com 2011-01-05 07:27:20 PST --- Not a bug, just a diagnostic suggestion. When compiling with warnings turned on, there is no visual output suggesting whether or not that warning is ignored or enforced as an error: ie: int main() { return 0; return 1; } $ dmd test.d -w test.d(4): Warning: statement is not reachable $ dmd test.d -wi test.d(4): Warning: statement is not reachable Would be handy if confronted with a notification that warnings are being treated as errors by the compiler. This small addition to vwarning has a nice effect: { char *p = loc.toChars(); +if (global.params.warnings == 1) +fprintf(stdmsg, %s: warnings being treated as errors\n, global.params.argv0); + if (*p) fprintf(stdmsg, %s: , p); mem.free(p); $ dmd test.d -w dmd: warnings being treated as errors test.d(4): Warning: statement is not reachable $ dmd test.d -wi test.d(4): Warning: statement is not reachable Regards -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
@safe functions
This is either a compiler bug, or outdated language documentation, but I'm having some freedom with @safe functions: * No casting from a pointer type to any type other than void*. * No modification of pointer values. * No taking the address of a local variable or function parameter. I've attached code which does all three of these things, which compiles and runs. Inline assembler was an error, as well as casting from integer to a pointer type, but I didn't test anything else. I'm using dmd2.exe as my compiler. begin 644 main.d M:6UP;W)T('-T9YS=1I;SL-@T*0'-a...@=f]i9!F;V\H:6YT('@I#0I[ M#0H):6YT($[#0H):6YT*B!Y(#T@)F$[(\O('1A:VEN9R!A91R97-S(]F M(QO8V%L('9AFEA8FQE#0H)8VAABH@B`](-AW0H8VAABHI3...@+r\@ M8V%S=EN9R!P;VEN=5R('1O(YO;BUP;VEN=5R('1Y4-@DJB`](#0[ M(\O('=R:71I;F@=7-I;F@;6%L9F]R;65D('!O:6YT97(-@D-@EY(#T@ M)g...@[(\O('1A:VEN9R!A91R97-S(]F('!AF%M971Eb...@04y$(-H86YG M:6YG('!O:6YT97(@=F%L=64-@DJ2`](#0[(\O(-H86YG:6YG('9A;'5E M#0H)#0H):6YT((@/2!C87-T*EN=EY.R`O+R!C87-T:6YG(9R;VT@]I M;G1EB!T7!E('1O('1Y4...@=AA=!IVXG=!V;v...@t*?0t*#0iv;VED G(UA:6XH*0T*PT*6EN=!X(#...@-3`[#0h)9F]O*'@I.PT*?0T* ` end
Re: @safe functions
Sean Eskapp eatingstap...@gmail.com wrote: This is either a compiler bug, or outdated language documentation, but I'm having some freedom with @safe functions: * No casting from a pointer type to any type other than void*. * No modification of pointer values. * No taking the address of a local variable or function parameter. I've attached code which does all three of these things, which compiles and runs. Inline assembler was an error, as well as casting from integer to a pointer type, but I didn't test anything else. I'm using dmd2.exe as my compiler. Safe-D is currently not implemented, at least in whole. Other issues also have higher priority. Also, this group is for automated messages from BugZilla. Please either post these things as bugs[1] or in the digitalmars.D.learn of digitalmars.D newsgroups. [1]: http://d.puremagic.com/issues/enter_bug.cgi -- Simen
Re: @safe functions
On Wed, 05 Jan 2011 15:35:09 +, Sean Eskapp wrote: This is either a compiler bug, or outdated language documentation, but I'm having some freedom with @safe functions: * No casting from a pointer type to any type other than void*. * No modification of pointer values. * No taking the address of a local variable or function parameter. I've attached code which does all three of these things, which compiles and runs. Inline assembler was an error, as well as casting from integer to a pointer type, but I didn't test anything else. I'm using dmd2.exe as my compiler. import std.stdio; @safe void foo(int x) { int a; int* y = a; // taking address of local variable char* z = cast(char*)y; // casting pointer to non-pointer type *z = 4; // writing using malformed pointer y = x; // taking address of parameter, AND changing pointer value *y = 4; // changing value int b = cast(int)y; // casting from pointer type to type that isn't void* } void main() { int x = 50; foo(x); } Hi! This forum is just a feed from Bugzilla, it is not meant for discussions. Please file a bug report at http://d.puremagic.com/issues/ instead. Thanks, Lars
[Issue 5411] import wtf1
http://d.puremagic.com/issues/show_bug.cgi?id=5411 --- Comment #3 from Ellery Newcomer ellery-newco...@utulsa.edu 2011-01-05 08:50:22 PST --- (In reply to comment #1) The selective imports only apply to std.algorithm, not std.stdio. std.algorithm publicly imports std.stdio, and so the selective import of writeln from std.algorithm works. The behavior is as expected. then why is std.algorithm.map in the local module symbol table? -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 5415] New: @Safe functions not working
http://d.puremagic.com/issues/show_bug.cgi?id=5415 Summary: @Safe functions not working Product: D Version: D2 Platform: All URL: http://www.digitalmars.com/d/2.0/function.html#functio n-safety OS/Version: Windows Status: NEW Severity: normal Priority: P2 Component: DMD AssignedTo: nob...@puremagic.com ReportedBy: eatingstap...@gmail.com --- Comment #0 from eatingstap...@gmail.com 2011-01-05 09:08:13 PST --- Created an attachment (id=860) Code showing features not working This is either a compiler bug, or outdated language documentation, but I'm having some freedom with @safe functions: * No casting from a pointer type to any type other than void*. * No modification of pointer values. * No taking the address of a local variable or function parameter. I've attached code which does all three of these things, which compiles and runs. Inline assembler was an error, as well as casting from integer to a pointer type, but I didn't test anything else. I'm using dmd2.exe as my compiler. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 5414] New: Language Reference errors
http://d.puremagic.com/issues/show_bug.cgi?id=5414 Summary: Language Reference errors Product: D Version: D2 Platform: All URL: http://www.digitalmars.com/d/2.0/ OS/Version: All Status: NEW Severity: normal Priority: P2 Component: websites AssignedTo: nob...@puremagic.com ReportedBy: eatingstap...@gmail.com --- Comment #0 from eatingstap...@gmail.com 2011-01-05 09:05:02 PST --- The Language Reference section of the D2.0 site is outdated in some parts, leading to some confusing mistakes. The part on local variables in functions has some outdated material, as well as the part on foreach, where the code uses differently-named functions from those listed in the table above. These are the two examples I remember, but I may have stumbled across a few others which I've forgotten. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 5073] wrong file name in error message for voids have no value inside alias templates (affects std.algorithm.map)
http://d.puremagic.com/issues/show_bug.cgi?id=5073 Rob Jacques sandf...@jhu.edu changed: What|Removed |Added Keywords||patch, wrong-code Severity|normal |regression --- Comment #1 from Rob Jacques sandf...@jhu.edu 2011-01-05 13:14:37 PST --- In DMD 2.051, this error message has ceased to be generated for certain inputs and instead a runtime access violation is generated. Here is a reduced test case: struct Bar(T) { T x; Bar dot(Bar b) { return Bar(x+b.x); } } void main(string[] args) { Bar!real b; Bar!real[] data = new Bar!real[5]; auto foobar = map!((a){return a.dot(b); })(data); return; } Here is a modified to std.algorithm.map that works arounds this specific bug: template map(fun...) { auto map(Range)(Range r) { static if (fun.length 1) { return Map!( unaryFun!( adjoin!(staticMap!(unaryFun, fun)) ), Range )(r); } else { static if( is(typeof(fun[0]) == delegate) ) { return Map!(fun, Range)(fun[0],r); } else { return Map!(unaryFun!fun, Range)(r); } } } } struct Map(alias fun, Range) if (isInputRange!(Range)) { Unqual!Range _input; static if( is(typeof(fun) == delegate) ) { typeof(fun) _fun; this(typeof(fun) dg, Range input) { _fun = dg; _input = input; } } else { alias fun _fun; this(Range input) { _input = input; } } alias typeof({ return _fun(.ElementType!(Range).init); }()) ElementType; static if (isBidirectionalRange!(Range)) { @property ElementType back(){ return _fun(_input.back); } voidpopBack() { _input.popBack;} } // Propagate infinite-ness. static if (isInfinite!Range) { enum bool empty = false; } else { @property bool empty() { return _input.empty; } } void popFront() { _input.popFront; } @property ElementType front() { return _fun(_input.front); } static if (isRandomAccessRange!Range) { ElementType opIndex(size_t index) { return _fun(_input[index]); } } // hasLength is busted, Bug 2873 static if (is(typeof(_input.length) : size_t) || is(typeof(_input.length()) : size_t)) { @property size_t length() { return _input.length; } } static if (hasSlicing!(Range)) { typeof(this) opSlice(size_t lowerBound, size_t upperBound) { auto result = this; result._input = result._input[lowerBound..upperBound]; return result; } } static if (isForwardRange!Range) @property Map save() { auto result = this; result._input = result._input.save; return result; } } -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 5411] import wtf1
http://d.puremagic.com/issues/show_bug.cgi?id=5411 Peter Alexander peter.alexander...@gmail.com changed: What|Removed |Added CC||peter.alexander...@gmail.co ||m --- Comment #4 from Peter Alexander peter.alexander...@gmail.com 2011-01-05 14:09:40 PST --- Another test: import std.stdio; void main() { writeln(std.algorithm.map!(a+1)([1,2,3])); // compiles } That succeeds (note lack of std.algorithm import) import std.stdio; void main() { writeln(map!(a+1)([1,2,3])); // error: map not defined } That doesn't. Where is map coming from? std.stdio doesn't use a public import for std.algorithm. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 5416] New: null should have a type of its own
http://d.puremagic.com/issues/show_bug.cgi?id=5416 Summary: null should have a type of its own Product: D Version: D2 Platform: Other OS/Version: Windows Status: NEW Severity: enhancement Priority: P2 Component: DMD AssignedTo: nob...@puremagic.com ReportedBy: simen.kja...@gmail.com --- Comment #0 from Simen Kjaeraas simen.kja...@gmail.com 2011-01-05 16:30:53 PST --- Currently, it is impossible to special-case comparisons with null. If instead null had its own type, one could allow direct comparisons between user-defined types and null, instead of supporting comparison with any and all void*s. For structs, such a comparison function could then be used for both 'foo == null' and 'foo is null'. For classes, neither likely makes sense. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 5417] New: Integer operations promote too much
http://d.puremagic.com/issues/show_bug.cgi?id=5417 Summary: Integer operations promote too much Product: D Version: D2 Platform: All OS/Version: Windows Status: NEW Severity: normal Priority: P2 Component: DMD AssignedTo: nob...@puremagic.com ReportedBy: eatingstap...@gmail.com --- Comment #0 from eatingstap...@gmail.com 2011-01-05 18:17:38 PST --- Created an attachment (id=861) Code with integer promotion When summing two shorts, they should not be both promoted to int, especially since this reduces the ability to pack things in registers. I've attached code which demonstrates summing two shorts as they are both promoted to int. The code will not build, with an error explaining that both parameters have been promoted, leading to the expression being of type int rather than short. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 5417] Integer operations promote too much
http://d.puremagic.com/issues/show_bug.cgi?id=5417 Walter Bright bugzi...@digitalmars.com changed: What|Removed |Added Status|NEW |RESOLVED CC||bugzi...@digitalmars.com Resolution||INVALID --- Comment #1 from Walter Bright bugzi...@digitalmars.com 2011-01-05 18:42:07 PST --- This behavior matches C integral promotion rules, which is by design, to make it easy for C programs and programmers to transition to D. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---