Jump to page: 1 24  
Page
Thread overview
'partial' keyword in C# is very good for project ,what's the same thing in D?
Oct 29, 2014
FrankLike
Oct 29, 2014
Paulo Pinto
Oct 29, 2014
Regan Heath
Oct 29, 2014
FrankLike
Oct 29, 2014
FrankLike
Oct 29, 2014
ketmar
Oct 29, 2014
Gary Willoughby
Oct 29, 2014
Walter Bright
Oct 30, 2014
andre
Oct 31, 2014
Dejan Lekic
Oct 31, 2014
ketmar
Oct 31, 2014
Paulo Pinto
Oct 31, 2014
FrankLike
Oct 31, 2014
Wyatt
Oct 31, 2014
ketmar
Nov 10, 2014
Regan Heath
Nov 10, 2014
FrankLike
Nov 10, 2014
Jacob Carlborg
Nov 10, 2014
Andre
Nov 10, 2014
Gary Willoughby
Nov 10, 2014
deadalnix
Nov 12, 2014
Regan Heath
Oct 31, 2014
Andrea Fontana
Oct 31, 2014
eles
Oct 31, 2014
deadalnix
Oct 29, 2014
deadalnix
Oct 30, 2014
Jacob Carlborg
Nov 08, 2014
FrankLike
Oct 31, 2014
Kagamin
Nov 01, 2014
tcak
October 29, 2014
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
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
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
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
>> 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
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
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
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
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
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
« First   ‹ Prev
1 2 3 4