Thread overview | ||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
October 29, 2014 'partial' keyword in C# is very good for project ,what's the same thing in D? | ||||
---|---|---|---|---|
| ||||
Hello,everyone, I've written some projects in C#,find the 'partial' keyword is very userful,which lets the auto codes in another single file,my codes are very easy to update. But what the same thing in D? Thank you,every one. |
October 29, 2014 Re: 'partial' keyword in C# is very good for project ,what's the same thing in D? | ||||
---|---|---|---|---|
| ||||
Posted in reply to FrankLike | On Wednesday, 29 October 2014 at 07:41:41 UTC, FrankLike wrote:
> Hello,everyone,
> I've written some projects in C#,find the 'partial' keyword is very userful,which lets the auto codes in another single file,my codes are very easy to update.
> But what the same thing in D?
>
> Thank you,every one.
Maybe mixins might be a possibility.
|
October 29, 2014 Re: 'partial' keyword in C# is very good for project ,what's the same thing in D? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Paulo Pinto | On Wed, 29 Oct 2014 07:54:39 -0000, Paulo Pinto <pjmlp@progtools.org> wrote: > On Wednesday, 29 October 2014 at 07:41:41 UTC, FrankLike wrote: >> Hello,everyone, >> I've written some projects in C#,find the 'partial' keyword is very userful,which lets the auto codes in another single file,my codes are very easy to update. >> But what the same thing in D? >> >> Thank you,every one. > > Maybe mixins might be a possibility. Something like.. class Foo { mixin(import("auto-generated.d")); } where auto-generated.d has class members/methods but no "class Foo" itself. Partial classes are used in C# wherever you need to combine auto-generated code and user code into a single class. So, the Windows GUI builder does it placing all the GUI component construction and property setting in one file, and allowing the user to only have to see/edit the application level code in another file. Likewise LINQ to SQL generates a custom DataContext child class, and the user can optionally create a 2nd file with the partial class to extend it. C# also has partial methods which are essentially abstract methods with a compiler generated empty body. They are not virtual as you cannot call a base.method() from method(), instead you optionally implement the method and if you don't it does nothing. LINQ to SQL uses these for insert/update/delete events for each table in your database. R -- Using Opera's revolutionary email client: http://www.opera.com/mail/ |
October 29, 2014 Re: 'partial' keyword in C# is very good for project ,what's the same thing in D? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Regan Heath | On Wednesday, 29 October 2014 at 10:25:54 UTC, Regan Heath wrote: > On Wed, 29 Oct 2014 07:54:39 -0000, Paulo Pinto <pjmlp@progtools.org> wrote: > >> On Wednesday, 29 October 2014 at 07:41:41 UTC, FrankLike wrote: >>> Hello,everyone, >>> I've written some projects in C#,find the 'partial' keyword is very userful,which lets the auto codes in another single file,my codes are very easy to update. >>> But what the same thing in D? >>> >>> Thank you,every one. >> > Partial classes are used in C# wherever you need to combine auto-generated code and user code into a single class. So, the Windows GUI builder does it placing all the GUI component construction and property setting in one file, and allowing the user to only have to see/edit the application level code in another file. Likewise LINQ to SQL generates a custom DataContext child class, and the user can optionally create a 2nd file with the partial class to extend it. > R The same thing in D should be done,now.Otherwise,no big projects can be done like C#. Add another keyword,and update the compiler. FrankLike |
October 29, 2014 Re: 'partial' keyword in C# is very good for project ,what's the same thing in D? | ||||
---|---|---|---|---|
| ||||
Posted in reply to FrankLike |
>> Partial classes are used in C# wherever you need to combine auto-generated code and user code into a single class. So, the Windows GUI builder does it placing all the GUI component construction and property setting in one file, and allowing the user to only have to see/edit the application level code in another file. Likewise LINQ to SQL generates a custom DataContext child class, and the user can optionally create a 2nd file with the partial class to extend it.
>
>> R
>
> The same thing in D should be done,now.Otherwise,no big projects can be very easily done like C#. Add another keyword,and update the compiler.
>
> FrankLike
|
October 29, 2014 Re: 'partial' keyword in C# is very good for project ,what's the same thing in D? | ||||
---|---|---|---|---|
| ||||
Posted in reply to FrankLike | On Wednesday, 29 October 2014 at 12:55:01 UTC, FrankLike wrote:
> The same thing in D should be done,now.Otherwise,no big projects can be done like C#. Add another keyword,and update the compiler.
Large projects are already being developed using D so your argument is wrong. Also no new keywords are being added to the language because D is trying to achieve stability right now.
You can achieve what you desire using mixins.
|
October 29, 2014 Re: 'partial' keyword in C# is very good for project , what's the same thing in D? | ||||
---|---|---|---|---|
| ||||
Posted in reply to FrankLike Attachments: | On Wed, 29 Oct 2014 12:58:28 +0000
FrankLike via Digitalmars-d <digitalmars-d@puremagic.com> wrote:
> > The same thing in D should be done,now.Otherwise,no big projects can be very easily done like C#.
just don't write in D "like C#". that's it.
|
October 29, 2014 Re: 'partial' keyword in C# is very good for project ,what's the same thing in D? | ||||
---|---|---|---|---|
| ||||
Posted in reply to FrankLike | On Wednesday, 29 October 2014 at 07:41:41 UTC, FrankLike wrote:
> Hello,everyone,
> I've written some projects in C#,find the 'partial' keyword is very userful,which lets the auto codes in another single file,my codes are very easy to update.
> But what the same thing in D?
>
> Thank you,every one.
What does it do ?
|
October 29, 2014 Re: 'partial' keyword in C# is very good for project ,what's the same thing in D? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Gary Willoughby | On 10/29/2014 7:01 AM, Gary Willoughby wrote:
> On Wednesday, 29 October 2014 at 12:55:01 UTC, FrankLike wrote:
>> The same thing in D should be done,now.Otherwise,no big projects can be done
>> like C#. Add another keyword,and update the compiler.
>
> Large projects are already being developed using D so your argument is wrong.
> Also no new keywords are being added to the language because D is trying to
> achieve stability right now.
>
> You can achieve what you desire using mixins.
Either string mixins, template mixins, alias this or opDispatch.
|
October 30, 2014 Re: 'partial' keyword in C# is very good for project ,what's the same thing in D? | ||||
---|---|---|---|---|
| ||||
Posted in reply to deadalnix | On 2014-10-30 00:00, deadalnix wrote: > What does it do ? It lets you split the implementation of a class between multiple source files. I think it's mostly used in C# for tools that generate some codes, i.e. a GUI builder. You have the generated part of the class in one file and the code that is manually edited in another file. -- /Jacob Carlborg |
Copyright © 1999-2021 by the D Language Foundation