digitalmars.D - package and virtual
- Jonathan M Davis (7/7) Feb 29 2012 package functions are currenly non-virtual.
- Jacob Carlborg (4/11) Feb 29 2012 Is anyone even using "package"? I've basically never used it.
- Jonathan M Davis (15/27) Feb 29 2012 is supposed to
- Rene Zwanenburg (6/35) Mar 01 2012 I agree, virtual package function would be nice. ATM, as a
- =?UTF-8?B?QWxleCBSw7hubmUgUGV0ZXJzZW4=?= (5/39) Mar 01 2012 I'd go further and say that's completely ridiculous. The language should...
- Kapps (11/26) Mar 01 2012 In a module based approach, it's not as useful. But for people
- Mike Parker (7/22) Mar 01 2012 I use it. Primarily for utility declarations shared among modules, but
- Jacob Carlborg (4/28) Mar 01 2012 I see, I see. I guess it's more used in Java because it's the default.
- Jonathan M Davis (7/34) Mar 01 2012 Well, it's kind of forced on you in Java when you want classes to intera...
- =?UTF-8?B?QWxleCBSw7hubmUgUGV0ZXJzZW4=?= (5/20) Mar 01 2012 I use it. It's useful when you wish to create higher-level wrappers
- Martin Nowak (4/24) Mar 01 2012 .)
- deadalnix (3/10) Mar 01 2012 I think virtuality and package should have nothing to with one another.
- =?UTF-8?B?QWxleCBSw7hubmUgUGV0ZXJzZW4=?= (4/20) Mar 01 2012 100% agree.
- Andrei Alexandrescu (4/23) Mar 01 2012 Same here, though importantly the compiler can use the information to
- Jacob Carlborg (5/21) Mar 01 2012 Currently we don't have a "virtual" keyword, meaning everything would
package functions are currenly non-virtual. The spec claims that "all non-static non-private non-template member func tions are virtual," which would mean that package is supposed to be virtual. But from what I recall, the plan is to leave package as non-virtual. So, is that indeed the case and the spec needs to be fixed, or is package going to be made virtual at some point? - Jonathan M Davis
Feb 29 2012
On 2012-03-01 01:53, Jonathan M Davis wrote:package functions are currenly non-virtual. The spec claims that "all non-static non-private non-template member func tions are virtual," which would mean that package is supposed to be virtual. But from what I recall, the plan is to leave package as non-virtual. So, is that indeed the case and the spec needs to be fixed, or is package going to be made virtual at some point? - Jonathan M DavisIs anyone even using "package"? I've basically never used it. -- /Jacob Carlborg
Feb 29 2012
On Thursday, March 01, 2012 08:26:00 Jacob Carlborg wrote:On 2012-03-01 01:53, Jonathan M Davis wrote:m=C2=ADplate mem=C2=ADberpackage functions are currenly non-virtual. =20 The spec claims that "all non-sta=C2=ADtic non-pri=C2=ADvate non-te=is supposed tofunc=C2=AD tions are vir=C2=ADtual," which would mean that package =be virtual. But from what I recall, the plan is to leave package as=ixed,non-virtual. So, is that indeed the case and the spec needs to be f=Well, it's the sort of thing that's more useful with larger programs, s= o I=20 question how much it's being used, but it definitely can be useful.=20 std.datetime will likely be using it in the near future, since I'm work= ing on=20 breaking it up into a package (leaving std.datetime to then import ever= ything=20 in the package). But regardless, it's currently broken: http://d.puremagic.com/issues/show_bug.cgi?id=3D143 - Jonathan M Davisor is package going to be made virtual at some point? =20 - Jonathan M Davis=20 Is anyone even using "package"? I've basically never used it.
Feb 29 2012
On Thursday, 1 March 2012 at 07:45:24 UTC, Jonathan M Davis wrote:On Thursday, March 01, 2012 08:26:00 Jacob Carlborg wrote:I agree, virtual package function would be nice. ATM, as a workaround we use a package function which forwards the call to a protected function, and give the constructors package protection so only classes in the same package can inherit from it. That works, but it's not perfect.On 2012-03-01 01:53, Jonathan M Davis wrote:Well, it's the sort of thing that's more useful with larger programs, so I question how much it's being used, but it definitely can be useful. std.datetime will likely be using it in the near future, since I'm working on breaking it up into a package (leaving std.datetime to then import everything in the package). But regardless, it's currently broken: http://d.puremagic.com/issues/show_bug.cgi?id=143 - Jonathan M Davispackage functions are currenly non-virtual. The spec claims that "all non-static non-private non-template member func tions are virtual," which would mean that package is supposed to be virtual. But from what I recall, the plan is to leave package as non-virtual. So, is that indeed the case and the spec needs to be fixed, or is package going to be made virtual at some point? - Jonathan M DavisIs anyone even using "package"? I've basically never used it.
Mar 01 2012
On 01-03-2012 11:34, Rene Zwanenburg wrote:On Thursday, 1 March 2012 at 07:45:24 UTC, Jonathan M Davis wrote:I'd go further and say that's completely ridiculous. The language should not impose such stupid semantics on you because of a visibility modifier. -- - AlexOn Thursday, March 01, 2012 08:26:00 Jacob Carlborg wrote:I agree, virtual package function would be nice. ATM, as a workaround we use a package function which forwards the call to a protected function, and give the constructors package protection so only classes in the same package can inherit from it. That works, but it's not perfect.On 2012-03-01 01:53, Jonathan M Davis wrote:Well, it's the sort of thing that's more useful with larger programs, so I question how much it's being used, but it definitely can be useful. std.datetime will likely be using it in the near future, since I'm working on breaking it up into a package (leaving std.datetime to then import everything in the package). But regardless, it's currently broken: http://d.puremagic.com/issues/show_bug.cgi?id=143 - Jonathan M Davispackage functions are currenly non-virtual.non-template memberThe spec claims that "all non-static non-private >func tions are virtual," which would mean that package > issupposed tobe virtual. But from what I recall, the plan is to leave > package as non-virtual. So, is that indeed the case and the spec needs > to befixed,or is package going to be made virtual at some point?Is anyone even using "package"? I've basically never used it.- Jonathan M Davis
Mar 01 2012
On Thursday, 1 March 2012 at 07:26:01 UTC, Jacob Carlborg wrote:On 2012-03-01 01:53, Jonathan M Davis wrote:In a module based approach, it's not as useful. But for people file/module per class, it is indeed useful. I've never had nor partially solves this by 'protected internal' where internal is essentially package; this allows it to be called as a package function but still be overridable and accessible from the inheriting class. I have found a few use cases for it, with a workaround of making a package function to call the protected function.package functions are currenly non-virtual. The spec claims that "all non-static non-private non-template member func tions are virtual," which would mean that package is supposed to be virtual. But from what I recall, the plan is to leave package as non-virtual. So, is that indeed the case and the spec needs to be fixed, or is package going to be made virtual at some point? - Jonathan M DavisIs anyone even using "package"? I've basically never used it.
Mar 01 2012
On 3/1/2012 4:26 PM, Jacob Carlborg wrote:On 2012-03-01 01:53, Jonathan M Davis wrote:I use it. Primarily for utility declarations shared among modules, but not intended for the outside world. For example, DerelictGL's extension loader. Incidentally, before reading this I just finished refactoring another project to use some package-protected stuff. But I've never had a need (yet) to override anything with package protection outside of the same module.package functions are currenly non-virtual. The spec claims that "all non-static non-private non-template member func tions are virtual," which would mean that package is supposed to be virtual. But from what I recall, the plan is to leave package as non-virtual. So, is that indeed the case and the spec needs to be fixed, or is package going to be made virtual at some point? - Jonathan M DavisIs anyone even using "package"? I've basically never used it.
Mar 01 2012
On 2012-03-01 14:43, Mike Parker wrote:On 3/1/2012 4:26 PM, Jacob Carlborg wrote:I see, I see. I guess it's more used in Java because it's the default. -- /Jacob CarlborgOn 2012-03-01 01:53, Jonathan M Davis wrote:I use it. Primarily for utility declarations shared among modules, but not intended for the outside world. For example, DerelictGL's extension loader. Incidentally, before reading this I just finished refactoring another project to use some package-protected stuff. But I've never had a need (yet) to override anything with package protection outside of the same module.package functions are currenly non-virtual. The spec claims that "all non-static non-private non-template member func tions are virtual," which would mean that package is supposed to be virtual. But from what I recall, the plan is to leave package as non-virtual. So, is that indeed the case and the spec needs to be fixed, or is package going to be made virtual at some point? - Jonathan M DavisIs anyone even using "package"? I've basically never used it.
Mar 01 2012
On Thursday, March 01, 2012 21:19:04 Jacob Carlborg wrote:On 2012-03-01 14:43, Mike Parker wrote:Well, it's kind of forced on you in Java when you want classes to interact without having the functions or variables involved be public, since all public classes must be in their own file. A lot of those cases can be covered in D by putting the classes in the same module. So, the value of package is definitely reduced in D, but it's not gone. - Jonathan M DavisOn 3/1/2012 4:26 PM, Jacob Carlborg wrote:I see, I see. I guess it's more used in Java because it's the default.On 2012-03-01 01:53, Jonathan M Davis wrote:I use it. Primarily for utility declarations shared among modules, but not intended for the outside world. For example, DerelictGL's extension loader. Incidentally, before reading this I just finished refactoring another project to use some package-protected stuff. But I've never had a need (yet) to override anything with package protection outside of the same module.package functions are currenly non-virtual. The spec claims that "all non-static non-private non-template member func tions are virtual," which would mean that package is supposed to be virtual. But from what I recall, the plan is to leave package as non-virtual. So, is that indeed the case and the spec needs to be fixed, or is package going to be made virtual at some point? - Jonathan M DavisIs anyone even using "package"? I've basically never used it.
Mar 01 2012
On 01-03-2012 08:26, Jacob Carlborg wrote:On 2012-03-01 01:53, Jonathan M Davis wrote:I use it. It's useful when you wish to create higher-level wrappers around stuff. (Interestingly, I only ever use package for constructors.) -- - Alexpackage functions are currenly non-virtual. The spec claims that "all non-static non-private non-template member func tions are virtual," which would mean that package is supposed to be virtual. But from what I recall, the plan is to leave package as non-virtual. So, is that indeed the case and the spec needs to be fixed, or is package going to be made virtual at some point? - Jonathan M DavisIs anyone even using "package"? I've basically never used it.
Mar 01 2012
On Thu, 01 Mar 2012 17:11:14 +0100, Alex R=C3=B8nne Petersen = <xtzgzorex gmail.com> wrote:On 01-03-2012 08:26, Jacob Carlborg wrote:On 2012-03-01 01:53, Jonathan M Davis wrote:package functions are currenly non-virtual. The spec claims that "all non-static non-private non-template member func=C2=AD tions are virtual," which would mean that package is supposed to be virtual. But from what I recall, the plan is to leave package as non-virtual.=I use it. It's useful when you wish to create higher-level wrappers =So, is that indeed the case and the spec needs to be fixed, or is package going to be made virtual at some point? - Jonathan M DavisIs anyone even using "package"? I've basically never used it.around stuff. (Interestingly, I only ever use package for constructors=.)Because 'package' doesn't work for anything but functions?
Mar 01 2012
Le 01/03/2012 01:53, Jonathan M Davis a écrit :package functions are currenly non-virtual. The spec claims that "all non-static non-private non-template member func tions are virtual," which would mean that package is supposed to be virtual. But from what I recall, the plan is to leave package as non-virtual. So, is that indeed the case and the spec needs to be fixed, or is package going to be made virtual at some point? - Jonathan M DavisI think virtuality and package should have nothing to with one another. package is supposed ot express visibility, not change behavior.
Mar 01 2012
On 01-03-2012 11:12, deadalnix wrote:Le 01/03/2012 01:53, Jonathan M Davis a écrit :100% agree. -- - Alexpackage functions are currenly non-virtual. The spec claims that "all non-static non-private non-template member func tions are virtual," which would mean that package is supposed to be virtual. But from what I recall, the plan is to leave package as non-virtual. So, is that indeed the case and the spec needs to be fixed, or is package going to be made virtual at some point? - Jonathan M DavisI think virtuality and package should have nothing to with one another. package is supposed ot express visibility, not change behavior.
Mar 01 2012
On 3/1/12 10:12 AM, Alex Rønne Petersen wrote:On 01-03-2012 11:12, deadalnix wrote:Same here, though importantly the compiler can use the information to optimize away virtuals that cannot be overridden. AndreiLe 01/03/2012 01:53, Jonathan M Davis a écrit :100% agree.package functions are currenly non-virtual. The spec claims that "all non-static non-private non-template member func tions are virtual," which would mean that package is supposed to be virtual. But from what I recall, the plan is to leave package as non-virtual. So, is that indeed the case and the spec needs to be fixed, or is package going to be made virtual at some point? - Jonathan M DavisI think virtuality and package should have nothing to with one another. package is supposed ot express visibility, not change behavior.
Mar 01 2012
On 2012-03-01 11:12, deadalnix wrote:Le 01/03/2012 01:53, Jonathan M Davis a écrit :Currently we don't have a "virtual" keyword, meaning everything would need to be virtual. -- /Jacob Carlborgpackage functions are currenly non-virtual. The spec claims that "all non-static non-private non-template member func tions are virtual," which would mean that package is supposed to be virtual. But from what I recall, the plan is to leave package as non-virtual. So, is that indeed the case and the spec needs to be fixed, or is package going to be made virtual at some point? - Jonathan M DavisI think virtuality and package should have nothing to with one another. package is supposed ot express visibility, not change behavior.
Mar 01 2012