July 19, 2006 Re: DMD 0.163 release | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Kirk McDonald | Kirk McDonald wrote:
> Excellent!
Thanks. I wanted to get all this done, as I want to spend some time putting the engine back in my car. I wanted to do it today, but I stupidly broke the motor mount and had to spend an hour getting a new one, then I found out I need a different chain for the hoist, ...
Hopefully, tomorrow I can get the durn thing back in. It's been nearly 2 years.
| |||
July 19, 2006 Re: DMD 0.163 release | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Walter Bright | On Tue, 18 Jul 2006 23:36:03 -0700, Walter Bright wrote: > Derek Parnell wrote: >> Given that the form "static import XXX" and "import XXX = whatever" both require XXX to be used when referencing members, the 'static' import is only required when one is not renaming the module, eg. "import io = std.stdio;" and "static import io = std.stdio;" are identical, I sort of liked the idea that dropped the need for 'static' and if one wanted to force FQN using the normal module name, one could have written "import std.stdio = std.stdio;". > > I thought of that too, but it would be a weird special case, as having: > > import foo.bar = std.stdio; > > would be quite bizarre. Hmmm... what about ... the situation where I use FQN with a utility module of some sort, but later I want to try out something different that might not make the cut. Instead of relocating files or adding mountains of version statements or recoding to use renamed modules, I could've done ... version(SuperTest) import util.string = debug.string; else import util.string; . . . util.string.somefunc(); . . . util.string.anotherfunc(); . . . util.string.yaf(); Anyhow, just a thought. -- Derek (skype: derek.j.parnell) Melbourne, Australia "Down with mediocrity!" 19/07/2006 5:08:20 PM | |||
July 19, 2006 Re: DMD 0.163 release | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Derek Parnell | "Derek Parnell" <derek@nomail.afraid.org> ??????:12pinsuw7ixot$.1uioiq6i09vc2$.dlg@40tude.net... > On Tue, 18 Jul 2006 13:13:37 -0700, Walter Bright wrote: > >> http://www.digitalmars.com/d/changelog.html >> >> This has all the new import changes in it. That breaks a lot of existing >> code (like dmdscript), the fixes are simple (adding more import >> declarations) but tedious. > > Thanks Walter. > > v0.163 compiled Build and all its modules without having to change a > single > line of code. None of my code was broken with this release. > > > However, I will need to upgrade Build to cater for the new module renaming syntax ASAP. > >> I couldn't find a better keyword choice than "static import". > > Given that the form "static import XXX" and "import XXX = whatever" both require XXX to be used when referencing members, the 'static' import is only required when one is not renaming the module, eg. "import io = std.stdio;" and "static import io = std.stdio;" are identical, I sort of liked the idea that dropped the need for 'static' and if one wanted to force FQN using the normal module name, one could have written "import std.stdio = std.stdio;". > If we can use FQN access a symbol directly, not need any importing, all things going bo be consistent and natural. int main(void) { std.stdio.writefln("Just do it"); // not need any importing ... } > -- > Derek > (skype: derek.j.parnell) > Melbourne, Australia > "Down with mediocrity!" > 19/07/2006 2:01:37 PM | |||
July 19, 2006 Re: DMD 0.163 release | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Kirk McDonald | Kirk McDonald wrote:
> Walter Bright wrote:
>
>>
>> http://www.digitalmars.com/d/changelog.html
>>
>> This has all the new import changes in it. That breaks a lot of existing code (like dmdscript), the fixes are simple (adding more import declarations) but tedious.
>>
>> I couldn't find a better keyword choice than "static import".
>>
>> The renaming uses '=' instead of 'as', 'from', or 'alias' for the reasons:
>>
>> 1) didn't want to add new keywords, especially ones like 'as' as I use that as a variable name
>>
>> 2) didn't need to add new keywords - adding them should be done only if using punctuation is completely unappealing
>>
>> 3) using '=' and ':' is visually more distinct than embedded keywords.
>
>
> I just updated Pyd to work with 0.163 (which was pretty painless), and uncovered a pecular bug. I can't seem to reproduce the exact error with a small example, but (in short) it doesn't seem to like source files named "object.d". Renaming the source file in question (to "dpyobject.d", which is actually a more fitting name and a change I've been meaning to make) solved the problem.
>
> For what it's worth, the precise compiler error was:
>
> C:\Python24\lib\site-packages\celerid\infrastructure\pyd\object.d(41): identifier 'Object' is not defined
> C:\Python24\lib\site-packages\celerid\infrastructure\pyd\object.d(41): Object is used as a type
> Assertion failure: 'b->type->ty == Tclass' on line 342 in file 'class.c'
>
> Line 41 is the top of the DPyObject class. It looks like, by calling my file object.d, it was somehow masking Phobos's object.d, and thus the Object class could not be found to subclass DPyObject from. Whatever. I renamed the file and it is now happy.
>
If I recall right, I managed to actually get this to work with a couple of requisites.
1 - The local module 'object' MUST be in a package. In other words, 'foo.object' can be made to work, but 'object' cannot.
2 - If the local module 'object' defines any classes, it should PUBLICLY import 'object' (no package; the Phobos module 'object') and should also explicitly declare its classes as children of 'object.Object'.
Although if using a different name for the module works well, then by all means do so. :) Also, I don't think one can use the name 'Object' for a class regardless. Unless... well, maybe our new 'static import' would obviate that restriction... I might have to experiment with that later.
-- Chris Nicholson-Sauls
| |||
July 19, 2006 Re: DMD 0.163 release | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Walter Bright | Walter, I'm glad you made these 'breaking changes'. Now is the right time to do this, and people won't mind 'fixing' their code. I think most people will actually be eager to adapt their code. Thanks, L. | |||
July 19, 2006 Re: DMD 0.163 release | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Walter Bright | Is this silly mistake new, or has it gone unnoticed all this time? http://www.digitalmars.com/d/operatoroverloading.html "Note: Comparing a reference to a class object against null should be done as: if (a is null) and not as: if (a == null) The latter is converted to: if (a.opCmp(null)) which will fail if opCmp() is a virtual function." Two problems: (a) you've got opCmp mixed up with opEquals (b) it makes no sense that this is under the heading "Overloading <, <=, > and >=". Putting it under "Overloading == and !=" would be *better*.... Stewart. | |||
July 19, 2006 Re: DMD 0.163 release | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Walter Bright | Walter Bright wrote:
>
> http://www.digitalmars.com/d/changelog.html
>
Thanks! Especially for breaking things (like making default imports private) to do things correctly.
Lucas
| |||
July 19, 2006 Re: DMD 0.163 release | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Boris Wang | > If we can use FQN access a symbol directly, not need any importing, all things going bo be consistent and natural. > > int main(void) > { > std.stdio.writefln("Just do it"); // not need any importing > ... > } Well, it's how C# (and other .NET languages) does that. But I think explicit module declarations are more informative (you just look at the beginnig of the file to find out what it depends on) and also aids tools like Build (no need to parse all the code to figure out dependencies) -- | |||
July 19, 2006 Re: DMD 0.163 release | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Walter Bright | Thanks again. The new imports look great. | |||
July 19, 2006 Re: DMD 0.163 release | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Walter Bright | In article <e9jfdd$1sb0$1@digitaldaemon.com>, Walter Bright says... > > >http://www.digitalmars.com/d/changelog.html > >This has all the new import changes in it. That breaks a lot of existing code (like dmdscript), the fixes are simple (adding more import declarations) but tedious. > >I couldn't find a better keyword choice than "static import". > >The renaming uses '=' instead of 'as', 'from', or 'alias' for the reasons: > >1) didn't want to add new keywords, especially ones like 'as' as I use that as a variable name > >2) didn't need to add new keywords - adding them should be done only if using punctuation is completely unappealing > >3) using '=' and ':' is visually more distinct than embedded keywords. Walter thanks for making the imports private by default! I'm glad you finally listen on this subject. ;) Keep up the good work!! ------------------------------------------------------------------- "Dare to reach for the Stars...Dare to Dream, Build, and Achieve!" ------------------------------------------------------------------- MKoD: http://spottedtiger.tripod.com/D_Language/D_Main_XP.html | |||
Copyright © 1999-2021 by the D Language Foundation
Permalink
Reply