Re: WTF! new in class is static?!?!

2018-06-09 Thread KingJoffrey via Digitalmars-d-learn
On Sunday, 10 June 2018 at 01:27:50 UTC, bauss wrote: On Saturday, 9 June 2018 at 12:40:07 UTC, RealProgrammer wrote: maybe you and others in the D 'community' should start paying attention to the 'opinions' of those who do professional development with professional compilers. I do

Re: WTF! new in class is static?!?!

2018-06-09 Thread KingJoffrey via Digitalmars-d-learn
On Saturday, 9 June 2018 at 12:56:55 UTC, rikki cattermole wrote: But unlike you "king", Bauss isn't using tor to ban evade. why you wanna ban little old me? is it cause I made a crticism of D? did i hurt your feelings? ..and everyone I know uses tor - and you should too - whether you're

Re: WTF! new in class is static?!?!

2018-06-09 Thread KingJoffrey via Digitalmars-d-learn
On Thursday, 7 June 2018 at 21:57:17 UTC, Steven Schveighoffer wrote: Yep, long-standing issue: https://issues.dlang.org/show_bug.cgi?id=2947 Almost a decade old! -Steve Another reason why I still refuse to bring my code to D. As if the module not respecting class encapsulation was not

Re: Remember the Vasa! by Bjarne Stroustrup

2018-06-02 Thread KingJoffrey via Digitalmars-d
On Saturday, 2 June 2018 at 00:49:04 UTC, Bastiaan Veelo wrote: These are exactly the things that enable us to bring a very large code base to D. Not just faster or better, it makes the difference between impossible and possible. And we are engineers needing to solve real-world problems, not

Re: Installation on Ubuntu 18.04 is broken

2018-06-01 Thread KingJoffrey via Digitalmars-d
On Friday, 1 June 2018 at 21:21:25 UTC, IntegratedDimensions wrote: Your failure is that D is not a major language. It's like saying that "No other dogs I've come across meow, why does this dog meow"? It's a cat stupid!! :0 Sorry. but I have already demonstrated, that in D, a dog can meow.

Re: Sealed classes - would you want them in D? (v2)

2018-05-22 Thread KingJoffrey via Digitalmars-d
On Monday, 21 May 2018 at 14:46:40 UTC, Sjoerd Nijboer wrote: This hypotetical unittest is testing a hypotetical class in a hypotetical module with hypotetical properties. Why is it outside the class? I don't know, maybe it needs access to two classes which are defined in thesame module. But

Re: Sealed classes - would you want them in D? (v2)

2018-05-21 Thread KingJoffrey via Digitalmars-d
On Monday, 21 May 2018 at 14:46:40 UTC, Sjoerd Nijboer wrote: Nope, I'm simply a bystander who sees lack of class scope as a "feature" of D that is usefull in some cases while not hurting idiomatic OOP as long as you only define a single class (+ unittests) inside a module. If you want that

Re: Sealed classes - would you want them in D? (v2)

2018-05-21 Thread KingJoffrey via Digitalmars-d
On Monday, 21 May 2018 at 14:46:40 UTC, Sjoerd Nijboer wrote: Also, I would verry much much like it if you would not resort to comparing me to "one of those facebook employees." It's just setting a mood for the conversation which no one likes, regardless what anyone thinks about facebook

Re: Sealed classes - would you want them in D? (v2)

2018-05-21 Thread KingJoffrey via Digitalmars-d
On Monday, 21 May 2018 at 13:36:32 UTC, 12345swordy wrote: If you resort to mockery, then that means you have lost the argument. I prefer to think of it as sarcasm, not mockery. Sarcasm is a form of intelligent expression, to wield however you see fit (not unlike a module in D ;-) For

Re: Sealed classes - would you want them in D? (v2)

2018-05-21 Thread KingJoffrey via Digitalmars-d
On Monday, 21 May 2018 at 13:39:12 UTC, Sjoerd Nijboer wrote: While you might say that a unittest shouldn't acces private members and only public members, there are plenty of testcases where one would want to write a unittest to set a given variable via public function and then test if the

Re: Sealed classes - would you want them in D? (v2)

2018-05-21 Thread KingJoffrey via Digitalmars-d
On Monday, 21 May 2018 at 09:16:42 UTC, Dave Jones wrote: da dah dah da dah dah dahh da d .. . ... da dah.. ..da.. da ...dadada.da...dada. Thanks Dave. Your contributions to the discussion have been really insightful, and most valuable. I'm sure we

Re: Sealed classes - would you want them in D? (v2)

2018-05-20 Thread KingJoffrey via Digitalmars-d
On Saturday, 19 May 2018 at 21:25:37 UTC, 0xEAB wrote: I wouldn't consider putting classes into own modules a workaround. In my opinion it's more or less the solution. I'll add your solution into my article - but, I'm not sure it really addresses my problem statement. The Problem

Re: Sealed classes - would you want them in D? (v2)

2018-05-20 Thread KingJoffrey via Digitalmars-d
On Sunday, 20 May 2018 at 11:19:01 UTC, Dave Jones wrote: On Sunday, 20 May 2018 at 02:45:25 UTC, KingJoffrey wrote: On Saturday, 19 May 2018 at 17:38:48 UTC, Gheorghe Gabriel wrote: But in D, everything is your friend - you don't get to manage You want to be taken seriously and yet you

Re: Error about constructor calls in loops/labels, but there are no loops and labels?

2018-05-19 Thread KingJoffrey via Digitalmars-d
On Sunday, 20 May 2018 at 03:13:12 UTC, Neia Neutuladh wrote: While it's mildly refreshing that you found something new to talk about, it would be nice if you found something productive to say. You're merely complaining that a person who has spent about two decades on D (for free), who has

Re: Override member variables

2018-05-19 Thread KingJoffrey via Digitalmars-d
On Saturday, 19 May 2018 at 18:09:56 UTC, Gheorghe Gabriel wrote: And of course, you cannot override private members. wtf! what do you mean we cannot override private members! that's at the core of D! what's with you anyway! (ohh. to those new to the forums, that's friendly sarcasm, cause

Re: Error about constructor calls in loops/labels, but there are no loops and labels?

2018-05-19 Thread KingJoffrey via Digitalmars-d
On Sunday, 20 May 2018 at 00:05:39 UTC, Jonathan M Davis wrote: As I understand it, in general, Walter is against doing ... All I ever hear, is walter walter walter mmm..takes me back to my childhood.. https://www.youtube.com/watch?v=-yZHveWFvqM

Re: Sealed classes - would you want them in D? (v2)

2018-05-19 Thread KingJoffrey via Digitalmars-d
On Saturday, 19 May 2018 at 17:38:48 UTC, Gheorghe Gabriel wrote: If you have sealed class A { private { // members } } Then you can't use the defualt 'private' if you need it for a specific member. But if sealed is an access type of a member, 99% you will use sealed insted

Re: Sealed classes - would you want them in D? (v2)

2018-05-19 Thread KingJoffrey via Digitalmars-d
On Saturday, 19 May 2018 at 21:25:37 UTC, 0xEAB wrote: On Thursday, 17 May 2018 at 10:34:18 UTC, Zoadian wrote: If class level protection is added, please do not call it sealed. People from c++ might be suprised by 'private' already. We do not have to confuse those c#ies too. I thought the

Re: Sealed classes - would you want them in D? (v2)

2018-05-19 Thread KingJoffrey via Digitalmars-d
On Saturday, 19 May 2018 at 17:15:45 UTC, Neia Neutuladh wrote: On Saturday, 19 May 2018 at 09:49:39 UTC, KingJoffrey wrote: On Saturday, 19 May 2018 at 09:37:56 UTC, Uknown wrote: The point was encapsulation as you defined it was broken. private members were directly modified outside their

Re: Sealed classes - would you want them in D? (v2)

2018-05-19 Thread KingJoffrey via Digitalmars-d
On Saturday, 19 May 2018 at 09:37:56 UTC, Uknown wrote: The point was encapsulation as you defined it was broken. private members were directly modified outside their class. In your words, everyone was a friend. This is why we have coding standards ;-)

Re: Sealed classes - would you want them in D? (v2)

2018-05-19 Thread KingJoffrey via Digitalmars-d
On Saturday, 19 May 2018 at 08:32:28 UTC, Uknown wrote: I ported your example to Java. Surprisingly, it compiled and executed just fine: All I see, is a class, with static members. How else would it work? This is the equivalent of my D example, in Java: ( it won't even compile. phew! )

Re: Sealed classes - would you want them in D? (v2)

2018-05-19 Thread KingJoffrey via Digitalmars-d
On Saturday, 19 May 2018 at 04:01:18 UTC, KingJoffrey wrote: So I've come full circle again, and believe my idea is worth further consideration. how about this (use a proper annotation). This will be less likely to confuse anyone from other languages. e.g --- module test;

Re: Sealed classes - would you want them in D? (v2)

2018-05-18 Thread KingJoffrey via Digitalmars-d
On Friday, 18 May 2018 at 16:24:24 UTC, Gheorghe Gabriel wrote: On Friday, 18 May 2018 at 15:57:06 UTC, bachmeier wrote: On Friday, 18 May 2018 at 15:40:52 UTC, KingJo class A { private int x; private(this) int y; } I agree that this looks a bit strange. My initial proposal was

Re: Sealed classes - would you want them in D? (v2)

2018-05-18 Thread KingJoffrey via Digitalmars-d
On Friday, 18 May 2018 at 16:24:24 UTC, Gheorghe Gabriel wrote: On Friday, 18 May 2018 at 15:57:06 UTC, bachmeier wrote: On Friday, 18 May 2018 at 15:40:52 UTC, KingJo class A { private int x; private(this) int y; } I agree that this looks a bit strange. My initial proposal was

Re: Sealed classes - would you want them in D? (v2)

2018-05-18 Thread KingJoffrey via Digitalmars-d
On Friday, 18 May 2018 at 20:30:21 UTC, Dave Jones wrote: So lets stop the pointless gentle mockery and concentrate solely on the pointless. Sounds like a plan! you mean, follow your lead? now there's a plan! I like robust conversations too ;-) But some semblance on sanity, in that

Re: Sealed classes - would you want them in D? (v2)

2018-05-18 Thread KingJoffrey via Digitalmars-d
On Friday, 18 May 2018 at 17:28:59 UTC, Steven Schveighoffer wrote: You can "simulate" this by putting the classes into their own submodules of the same package. That just another hack to get around the problem. It's not a solution to removing the problem, from being a problem. (yeah, I

Re: Sealed classes - would you want them in D? (v2)

2018-05-18 Thread KingJoffrey via Digitalmars-d
On Friday, 18 May 2018 at 22:10:51 UTC, Maurice Huuskes wrote: The only thing that's going to drive this discussion forward is a few example use-cases (potentially borrowed from other languages that ran into similar 'problems'). I am new to D myself and how private works did surprise me but

Re: Sealed classes - would you want them in D? (v2)

2018-05-18 Thread KingJoffrey via Digitalmars-d
On Friday, 18 May 2018 at 14:32:33 UTC, bachmeier wrote: As clean and uncontroversial as this proposal might be, it unfortunately doesn't resolve the biggest issue. If you try to write Java code in D, you're still going to be using private, and you're still going to be caught by surprise.

Re: Sealed classes - would you want them in D? (v2)

2018-05-18 Thread KingJoffrey via Digitalmars-d
On Friday, 18 May 2018 at 12:51:42 UTC, Steven Schveighoffer wrote: Awesome, I love being on lists! Well, just remember to vote *down* the dip then, cause if doesn't get through, your quote be on my list of 'why OOP programmers should not consider D' ;-) It happened to me too!

Re: Sealed classes - would you want them in D? (v2)

2018-05-18 Thread KingJoffrey via Digitalmars-d
On Friday, 18 May 2018 at 12:26:14 UTC, Gheorghe Gabriel wrote: Good idea. Or: private(this) Because using "this" it is easier tu put this code in a mixin for multiple classes. Also, it also removes the redundancy of referring to the actual class name - as in: private(this) int i; //

Re: Sealed classes - would you want them in D? (v2)

2018-05-18 Thread KingJoffrey via Digitalmars-d
On Friday, 18 May 2018 at 12:32:30 UTC, Mike Parker wrote: private(this) int y; I think that might be it. So clean. This keeps the implementation simple and the scope focused. If a DIP were put forward, I think this would be the approach to take. Though a fairly strong case will still

Re: Sealed classes - would you want them in D? (v2)

2018-05-18 Thread KingJoffrey via Digitalmars-d
On Friday, 18 May 2018 at 12:00:58 UTC, Gheorghe Gabriel wrote: I think this code has cleaner sintax: class A { private int x; sealed int y; } void main() { A a = new A(); a.x = 7; // ok, it's private to module a.y = 3; // error, it's sealed to class } I agree. I actually

Re: Sealed classes - would you want them in D? (v2)

2018-05-18 Thread KingJoffrey via Digitalmars-d
On Friday, 18 May 2018 at 11:41:33 UTC, KingJoffrey wrote: .. I should have also added: good luck rememebering to use private, cause public is default (ha haa haaa). then again, private is public, so I guess it doesn't matter. enjoy those debugging sessions...

Re: Sealed classes - would you want them in D? (v2)

2018-05-18 Thread KingJoffrey via Digitalmars-d
On Friday, 18 May 2018 at 09:07:57 UTC, Dave Jones wrote: FFS you're so dramatic. First the world is ending because private doesnt work as you expected. Then D is utterly useless without the changes you want. Now we live in some dystopian nightmare where we are all slaves to the Dlang spec.

Re: Sealed classes - would you want them in D? (v2)

2018-05-17 Thread KingJoffrey via Digitalmars-d
On Thursday, 17 May 2018 at 14:14:28 UTC, Steven Schveighoffer wrote: D's main draw is not OOP. So if you are here for OOP goodies, then you are definitely better off looking elsewhere. I'll add that too my list of D forum quotes. That being said, D does have OOP, and many OOP programmers

Re: Sealed classes - would you want them in D? (v2)

2018-05-17 Thread KingJoffrey via Digitalmars-d
On Thursday, 17 May 2018 at 13:28:19 UTC, Steven Schveighoffer wrote: Essentially, if you put your class you want "sealed" into it's own module, and then publicly import the module from the API module, you will get the same effect. This is even easier now with the package module than it used

Re: Sealed classes - would you want them in D? (v2)

2018-05-17 Thread KingJoffrey via Digitalmars-d
On Thursday, 17 May 2018 at 11:56:51 UTC, Piotr Mitana wrote: To sum up [TLDR]: I don't see your arguments strong enough to alter the language (especially make a cross-language confusion over the "sealed" keyword), but DScaner check would still allow to track down what you consider bad.

Re: Sealed classes - would you want them in D? (v2)

2018-05-17 Thread KingJoffrey via Digitalmars-d
On Thursday, 17 May 2018 at 11:56:51 UTC, Piotr Mitana wrote: My opinion is that it's not worth a new keyword and time for implementing. In the same manner you could ask for removing friend concept from C++ as a bad concept. I don't answer the question whether this concept is good or bad -

Re: Sealed classes - would you want them in D? (v2)

2018-05-17 Thread KingJoffrey via Digitalmars-d
On Thursday, 17 May 2018 at 10:34:18 UTC, Zoadian wrote: On Thursday, 17 May 2018 at 02:32:07 UTC, KingJoffrey wrote: I propose an idea, for discussion (robust discussion even better ;-) Add an new attribute to class, named 'sealed'. If class level protection is added, please do not call it

Re: Sealed classes - would you want them in D? (v2)

2018-05-17 Thread KingJoffrey via Digitalmars-d
On Thursday, 17 May 2018 at 07:36:40 UTC, arturg wrote: no, that uses type inferance. you have to do Animal dog = new Dog; i tried it... certainly interesting.. thanks. but, I don't recall in my opening post, saying I'm ok with having to create an interface for every class I create, just so

Re: Sealed classes - would you want them in D? (v2)

2018-05-17 Thread KingJoffrey via Digitalmars-d
On Thursday, 17 May 2018 at 06:03:19 UTC, arturg wrote: you could declare the public api of your class inside an actual interface then use it instead of the class, that wont give you access to the private members of the class. you mean like this? module test;

Re: Sealed classes - would you want them in D? (v2)

2018-05-16 Thread KingJoffrey via Digitalmars-d
On Thursday, 17 May 2018 at 04:01:11 UTC, Neia Neutuladh wrote: I mean, usually we need to do a cost/benefit analysis, ... The benefit is explained in my opening discussion. That is, i can have more than just a single class in a module file, as still be able to 'program to the interface' of

Re: Sealed classes - would you want them in D? (v2)

2018-05-16 Thread KingJoffrey via Digitalmars-d
On Thursday, 17 May 2018 at 04:01:11 UTC, Neia Neutuladh wrote: so you have more work to do if you want to convince anyone. Again, a reminder, this is not a DIP. It's *just* a discussion. The purpose of the discussion is not necessarly to convince anyone, of anything. The purpose of the

Re: Sealed classes - would you want them in D? (v2)

2018-05-16 Thread KingJoffrey via Digitalmars-d
On Thursday, 17 May 2018 at 04:01:11 UTC, Neia Neutuladh wrote: Can you provide even one anecdote where this would have been useful and the workaround that has been suggested to you multiple times (putting the type in its own module) wouldn't have worked or would have caused other problems?

Re: Sealed classes - would you want them in D? (v2)

2018-05-16 Thread KingJoffrey via Digitalmars-d
On Thursday, 17 May 2018 at 04:01:11 UTC, Neia Neutuladh wrote: If you just want to vent, though, you might say that explicitly. This is hardly a great way to start the discussion. When I said robust, I meant useful too.

Re: Sealed classes - would you want them in D? (v2)

2018-05-16 Thread KingJoffrey via Digitalmars-d
On Thursday, 17 May 2018 at 02:32:07 UTC, KingJoffrey wrote: I propose an idea, for discussion (robust discussion even better ;-) oh, and it would be great, if the D 'elite' could way in to the discussion as well, as opposed to only waying in *after* a DIP is put forward. All ideas

Sealed classes - would you want them in D? (v2)

2018-05-16 Thread KingJoffrey via Digitalmars-d
I propose an idea, for discussion (robust discussion even better ;-) Add an new attribute to class, named 'sealed'. No, not sealed as in Scala. No, not sealed as in C# sealed as in oxford dictionary (close securely, non-porous). when sealed is applied on the class, this means the class is

Re: Sealed classes - would you want them in D?

2018-05-16 Thread KingJoffrey via Digitalmars-d
On Thursday, 17 May 2018 at 01:36:47 UTC, KingJoffrey wrote: how about adding a 'private' attribute on the class, which would mean, private inside the class is only accessible inside the class. I presume the private attribute on the class, is not currently valid in D? or even 'sealed'

Re: Sealed classes - would you want them in D?

2018-05-16 Thread KingJoffrey via Digitalmars-d
On Wednesday, 16 May 2018 at 16:43:31 UTC, Walter Bright wrote: I had no idea. It's either parallel gestation of a great idea, or they took it from D! the splitting of the atom was a great idea too..now the world is on the brink of destruction (according to some). how about adding a

Re: Sealed classes - would you want them in D?

2018-05-16 Thread KingJoffrey via Digitalmars-d
On Wednesday, 16 May 2018 at 13:09:22 UTC, Jesse Phillips wrote: That isn't a bug. What is the software use case? How did this case differ because someone did this? Sorry, I didn't realise my example was so complex. Hang on... I'll just put it all into a use case diagram in my new UML

Re: Sealed classes - would you want them in D?

2018-05-16 Thread KingJoffrey via Digitalmars-d
On Wednesday, 16 May 2018 at 13:09:22 UTC, Jesse Phillips wrote: Global variables and singletons are also frowned on, but call it bad coding not a bug. Come on, really? that's just word play, much like the use of the 'private' declaration in a class (in D that is). (also, this was not an

Re: auto: useful, annoying or bad practice?

2018-05-16 Thread KingJoffrey via Digitalmars-d
On Monday, 30 April 2018 at 21:11:07 UTC, Gerald wrote: So I'm curious, what's the consensus on auto? In the example below, what would I use, besides auto? module test; void main () { import std.stdio : writeln; auto result = newKing("King Joffrey");

Re: Sealed classes - would you want them in D?

2018-05-16 Thread KingJoffrey via Digitalmars-d
On Wednesday, 16 May 2018 at 10:24:02 UTC, Jonathan M Davis wrote: Part of the problem with D's spec is that it's basically both trying to be a specification for the language and be a way to explain the language to the typical programmer, and those aren't really compatible goals. We really

Re: Sealed classes - would you want them in D?

2018-05-16 Thread KingJoffrey via Digitalmars-d
On Wednesday, 16 May 2018 at 06:17:51 UTC, Uknown wrote: `public` by default is again not a problem. Just apply `private` as necessary. it's not a problem 'if' you 'remember' to use 'private'. private 'within the module' is also not a problem, 'if' you 'remember' that, when using private

Re: Sealed classes - would you want them in D?

2018-05-16 Thread KingJoffrey via Digitalmars-d
On Wednesday, 16 May 2018 at 06:11:13 UTC, Tobias Müller wrote: KingJoffrey wrote: actually, private is default in Rust. public is default in D. also, in Rust, private is private within the module, *and* its descendants. I don't believe that is the case in D

Re: Sealed classes - would you want them in D?

2018-05-16 Thread KingJoffrey via Digitalmars-d
On Wednesday, 16 May 2018 at 06:11:13 UTC, Tobias Müller wrote: KingJoffrey wrote: actually, private is default in Rust. public is default in D. also, in Rust, private is private within the module, *and* its descendants. I don't believe that is the case in D

Re: Sealed classes - would you want them in D?

2018-05-16 Thread KingJoffrey via Digitalmars-d
On Wednesday, 16 May 2018 at 05:59:17 UTC, Tobias Müller wrote: KingJoffrey wrote: The problem is not so much D, but that C++/Java/C# programmers, and many from other languages (Go, Rust) will expect private to mean private...not private..depending on

Re: Sealed classes - would you want them in D?

2018-05-16 Thread KingJoffrey via Digitalmars-d
On Wednesday, 16 May 2018 at 05:59:17 UTC, Tobias Müller wrote: KingJoffrey wrote: The problem is not so much D, but that C++/Java/C# programmers, and many from other languages (Go, Rust) will expect private to mean private...not private..depending on

Re: Sealed classes - would you want them in D?

2018-05-15 Thread KingJoffrey via Digitalmars-d
On Wednesday, 16 May 2018 at 05:43:58 UTC, KingJoffrey wrote: Also, having a C++ like spec, written by the elite, for the elite, and then everyone else has to wait until some kind person explains the spec, is really not a great model. It's equivalent to the elitist view of trickle down

Re: Sealed classes - would you want them in D?

2018-05-15 Thread KingJoffrey via Digitalmars-d
On Wednesday, 16 May 2018 at 04:25:40 UTC, Jonathan M Davis wrote: I think that really what you want is something that's geared more towards teaching the language. The ways that the language spec needs to be improved really revolve around making it a proper spec, which means making it far more

Re: Sealed classes - would you want them in D?

2018-05-15 Thread KingJoffrey via Digitalmars-d
On Wednesday, 16 May 2018 at 04:25:40 UTC, Jonathan M Davis wrote: The ways that the language spec needs to be improved really revolve around making it a proper spec, which means making it far more precise, not making it more amenable to folks reading it in order to learn the language. I

Re: Sealed classes - would you want them in D?

2018-05-15 Thread KingJoffrey via Digitalmars-d
On Wednesday, 16 May 2018 at 03:52:43 UTC, Uknown wrote: One is expected to know the tool they are using. There is nothing elitist about that. That is a pathetic, and yet another elitist view. If programmers never programmed until they 'understood the tool', there would not be 20+

Re: Sealed classes - would you want them in D?

2018-05-15 Thread KingJoffrey via Digitalmars-d
On Wednesday, 16 May 2018 at 03:12:03 UTC, Jonathan M Davis wrote: It specifies what private does quite accurately. If you want something that's trying to point out how you might misunderstand the spec or what problems you might run into, you'll need to read something like Ali's book. The

Re: Sealed classes - would you want them in D?

2018-05-15 Thread KingJoffrey via Digitalmars-d
On Tuesday, 15 May 2018 at 19:56:58 UTC, Patrick Schluter wrote: On Tuesday, 15 May 2018 at 02:32:05 UTC, KingJoffrey wrote: On Tuesday, 15 May 2018 at 02:00:17 UTC, 12345swordy wrote: On Tuesday, 15 May 2018 at 00:28:42 UTC, KingJoffrey wrote: On Monday, 14 May 2018 at 19:40:18 UTC,

Re: Sealed classes - would you want them in D?

2018-05-15 Thread KingJoffrey via Digitalmars-d
On Tuesday, 15 May 2018 at 21:05:10 UTC, Jonathan M Davis wrote: Though if someone expects to be able to just jump into any language and use it without reading up on how it works, they're just shooting themselves in the foot. And surprisingly often, that seems to be how many folks operate.

Re: Sealed classes - would you want them in D?

2018-05-15 Thread KingJoffrey via Digitalmars-d
On Wednesday, 16 May 2018 at 02:15:45 UTC, KingJoffrey wrote: "The unit of object encapsulation in D is the class." - page 175, The D Programming Language, 2010, Andrei Alexandrescu. What it really should have included, locally, within that same section, is the implications of this

Re: Sealed classes - would you want them in D?

2018-05-15 Thread KingJoffrey via Digitalmars-d
On Tuesday, 15 May 2018 at 21:05:10 UTC, Jonathan M Davis wrote: Ultimately, if newcomers don't want to be tripped up on stuff like this, their best bet is probably to read books like Andrei's "The D Programming Language" and Ali's "Programming in D." "The unit of object encapsulation in

Re: Sealed classes - would you want them in D?

2018-05-15 Thread KingJoffrey via Digitalmars-d
On Tuesday, 15 May 2018 at 15:19:33 UTC, Jesse Phillips wrote: On Tuesday, 15 May 2018 at 10:19:58 UTC, KingJoffrey wrote: My own code in D had bugs, cause I didn't realise all my private parts were not just visible, but accessible by all the so called 'friends' around me. They could reach in

Re: Sealed classes - would you want them in D?

2018-05-15 Thread KingJoffrey via Digitalmars-d
On Tuesday, 15 May 2018 at 14:34:07 UTC, bachmeier wrote: I think I'm missing something. Why is it a problem that you can do this? How do other languages prevent you from doing it? C# example (silly, but it demonstrates the point). The problem is not so much D, but that C++/Java/C#

Re: Sealed classes - would you want them in D?

2018-05-15 Thread KingJoffrey via Digitalmars-d
On Tuesday, 15 May 2018 at 07:23:55 UTC, Jonathan M Davis wrote: The prime one is unit tests. The fact that they can access the private variables is invaluable for testing the state of an object. In C++, I have always have to make all of the tests friends of the class so that they can access

Re: Sealed classes - would you want them in D?

2018-05-15 Thread KingJoffrey via Digitalmars-d
On Tuesday, 15 May 2018 at 05:59:44 UTC, Mike Parker wrote: Jonathan's right. We're just not going to agree on this. The purpose of discussion is not necessarly to get one side to agree with other side. You can keep your grouping and get your strict encapsulation like so: //

Re: Sealed classes - would you want them in D?

2018-05-14 Thread KingJoffrey via Digitalmars-d
On Tuesday, 15 May 2018 at 04:46:18 UTC, Jonathan M Davis wrote: Pretty much the worst that happens is you accidentally use a member variable directly instead of using a property function to access it, and that's rarely a big deal. Often, it's even desirable. I'll keep that argument for the

Re: Sealed classes - would you want them in D?

2018-05-14 Thread KingJoffrey via Digitalmars-d
On Tuesday, 15 May 2018 at 04:46:18 UTC, Jonathan M Davis wrote: If you really insist on the viewpoint that class encapsulation means that nothing outside of that class can access any of its private members, then what D does definitely breaks encapsulation. But having friends in C++ already

Re: Sealed classes - would you want them in D?

2018-05-14 Thread KingJoffrey via Digitalmars-d
On Tuesday, 15 May 2018 at 04:22:30 UTC, Mike Parker wrote: On Tuesday, 15 May 2018 at 02:32:05 UTC, KingJoffrey wrote: - Object independence - Do not violate encapsulation - Respect the interface This is what I don't get from your position. What is encapsulation? Here's what Wikipedia

Re: Sealed classes - would you want them in D?

2018-05-14 Thread KingJoffrey via Digitalmars-d
On Tuesday, 15 May 2018 at 03:32:22 UTC, Norm wrote: I'm seeing the opposite, more and more large applications adopting Python as much as possible and replacing big chunks of the C++ core and leaving only those C++ chunks where performance is all that really matters. Encapsulation

Re: Sealed classes - would you want them in D?

2018-05-14 Thread KingJoffrey via Digitalmars-d
On Tuesday, 15 May 2018 at 02:00:17 UTC, 12345swordy wrote: On Tuesday, 15 May 2018 at 00:28:42 UTC, KingJoffrey wrote: On Monday, 14 May 2018 at 19:40:18 UTC, 12345swordy wrote: A slippery slope fallacy isn't helping your case. Write a DIP if it bothers you so much, as it changes the

Re: Sealed classes - would you want them in D?

2018-05-14 Thread KingJoffrey via Digitalmars-d
On Monday, 14 May 2018 at 19:40:18 UTC, 12345swordy wrote: A slippery slope fallacy isn't helping your case. Write a DIP if it bothers you so much, as it changes the languages fundamentally. Alexander If 'getting a module to respect the enscapsulation boundaries the programmer puts in

Re: Sealed classes - would you want them in D?

2018-05-14 Thread KingJoffrey via Digitalmars-d
On Monday, 14 May 2018 at 07:59:06 UTC, Jonathan M Davis wrote: .. In addition, we rely on function encapsulation for Voldemort types... Actually, we rely on encapsulation (boundaries) for a lot more than that. How do we get from the orange room to the blue room, if there is no boundary?

Re: Is D releasing too often?

2018-05-14 Thread KingJoffrey via Digitalmars-d
On Monday, 14 May 2018 at 07:20:48 UTC, Joakim wrote: I thought 6/year was an ambitious schedule when announced and I wonder if it isn't putting too much strain on our few release maintainers, maybe 3-4 releases/year would be a more gradual bump up. This is what happens to programming

Re: Sealed classes - would you want them in D?

2018-05-14 Thread KingJoffrey via Digitalmars-d
On Monday, 14 May 2018 at 07:03:35 UTC, Dukc wrote: module test; void main() { foo.i = 2; } void foo() { static int i = 1; } nice, .. I like it... I mean who really needs a function interface anyway? D may as well just get rid of that encapsulation concept too,

Re: Module-level privacy

2018-05-12 Thread KingJoffrey via Digitalmars-d
On Sunday, 13 May 2018 at 05:11:16 UTC, Neia Neutuladh wrote: Nobody's getting worked up about this, and nobody's telling you to stop talking about it. There have been suggestions that you write up a DIP for it. This is a standard process for suggesting improvements to D. Your complaint is

Re: Sealed classes - would you want them in D?

2018-05-12 Thread KingJoffrey via Digitalmars-d
On Sunday, 13 May 2018 at 02:10:31 UTC, Uknown wrote: Again, all you have to do is put class Person in a separate module. This is such a nonsense solution. Why do you keep proposing it? Is this you way to effectively sweep the problem under the carpet? For me, a module presents the

Re: Sealed classes - would you want them in D?

2018-05-12 Thread KingJoffrey via Digitalmars-d
On Sunday, 13 May 2018 at 02:10:31 UTC, Uknown wrote: And please, if this bothers you so much, start a new thread. You're spamming someone else's feature request by going off topic. yeah, I know how much *you* (and many others) would like to shutdown any discussion about the absurd way in

Re: Sealed classes - would you want them in D?

2018-05-12 Thread KingJoffrey via Digitalmars-d
On Saturday, 12 May 2018 at 18:19:48 UTC, Jonathan M Davis wrote: I have never seen encapsulation issues where someone accidentally uses some private piece of a class or struct by accident elsewhere in the module, and the code therefore ends up with a bug. Then you've never seem me

Re: Sealed classes - would you want them in D?

2018-05-12 Thread KingJoffrey via Digitalmars-d
On Saturday, 12 May 2018 at 18:36:59 UTC, Walter Bright wrote: On 5/12/2018 9:42 AM, Mike Parker wrote: Thank goodness we don't have to do this silliness. I always thought the 'friend' business in C++ was an awful hack. But C++ didn't have modules, and modules are a much better solution to

Re: Sealed classes - would you want them in D?

2018-05-12 Thread KingJoffrey via Digitalmars-d
On Saturday, 12 May 2018 at 13:38:18 UTC, Walter Bright wrote: Mike's right. D's encapsulation model is designed around the module. Actually, that is not true. If it were true, then I could do: module test; void main() { i = 2; } // sorry, but i belongs to another unit of

Re: Sealed classes - would you want them in D?

2018-05-12 Thread KingJoffrey via Digitalmars-d
On Saturday, 12 May 2018 at 07:39:04 UTC, Jonathan M Davis wrote: Ultimately, it's a tradeoff, and arguments can be made for and against. But in practice, it works extremely well. You're certainly free to not like this particular design choice, but it's one that most of us have no problem

Re: Sealed classes - would you want them in D?

2018-05-12 Thread KingJoffrey via Digitalmars-d
On Saturday, 12 May 2018 at 07:19:47 UTC, rikki cattermole wrote: I see no problem. onlineapp.d(1): Error: label wtf is undefined The 'Error' is my point. It's not possible to do this - which is a good thing. D protects the encapsulation unit of the function from such abuse. But the same

Re: Sealed classes - would you want them in D?

2018-05-12 Thread KingJoffrey via Digitalmars-d
On Saturday, 12 May 2018 at 06:38:16 UTC, rikki cattermole wrote: Now move Person into its own module. Boom errors. This is how module systems should work and everything is working correctly :) You will not convince us otherwise. If D treated functions, like it treats classes, then you

Re: Sealed classes - would you want them in D?

2018-05-12 Thread KingJoffrey via Digitalmars-d
On Saturday, 12 May 2018 at 04:29:32 UTC, Neia Neutuladh wrote: On Friday, 11 May 2018 at 14:05:25 UTC, KingJoffrey wrote: private is not private at all in D, and because of this, classes are fundamentally broken in D (by design apparently). I find this amusing because D does things exactly

Re: Sealed classes - would you want them in D?

2018-05-11 Thread KingJoffrey via Digitalmars-d
On Friday, 11 May 2018 at 19:30:51 UTC, bauss wrote: It's a problem to you, but not to me and I'm sure many others in the D community can agree that private being module level has a lot of benefits over private being "class-level". These are the benefit I can see: - it encourages more

Re: Sealed classes - would you want them in D?

2018-05-11 Thread KingJoffrey via Digitalmars-d
On Saturday, 12 May 2018 at 00:39:29 UTC, Mike Parker wrote: Again, they're in the same module. From an encapsulation stand point, what does it matter that private members are within or without any specific set of curly braces? It only matters if you want to adhere to a purely conceptual

Re: Sealed classes - would you want them in D?

2018-05-11 Thread KingJoffrey via Digitalmars-d
On Friday, 11 May 2018 at 12:59:21 UTC, Piotr Mitana wrote: Might I suggest going back to the sealed classes topic? I don't think the discussion in this thread should go in the direction about the sense of using classes, proper encapsulation and the memory related stuff. Actually, it is

Re: Sealed classes - would you want them in D?

2018-05-11 Thread KingJoffrey via Digitalmars-d
On Friday, 11 May 2018 at 11:37:17 UTC, rikki cattermole wrote: Well then, since you don't like how it is now, lets see the DIP. it deserves to treated as a 'bug', not an DIP.

Re: Sealed classes - would you want them in D?

2018-05-11 Thread KingJoffrey via Digitalmars-d
On Friday, 11 May 2018 at 10:43:19 UTC, rikki cattermole wrote: Classes are expensive, not everybody wants to pay for what it gives in all situations. Mmm...that claim is so broad is to be meaningless. Good memory allocation algorithms, intelligent optimising compilers/runtimes, prudent use

Re: Sealed classes - would you want them in D?

2018-05-11 Thread KingJoffrey via Digitalmars-d
On Friday, 11 May 2018 at 09:47:39 UTC, Dukc wrote: On Friday, 11 May 2018 at 04:43:09 UTC, KingJoffrey wrote: On Friday, 11 May 2018 at 03:32:25 UTC, Uknown wrote: `private` is for outside the module. Within the module, private is not applied because D wanted to avoid C++'s `friend`

Re: Sealed classes - would you want them in D?

2018-05-10 Thread KingJoffrey via Digitalmars-d
On Friday, 11 May 2018 at 05:10:08 UTC, Uknown wrote: On Friday, 11 May 2018 at 04:43:09 UTC, KingJoffrey wrote: On Friday, 11 May 2018 at 03:32:25 UTC, Uknown wrote: `private` is for outside the module. Within the module, private is not applied because D wanted to avoid C++'s `friend`

Re: Sealed classes - would you want them in D?

2018-05-10 Thread KingJoffrey via Digitalmars-d
On Friday, 11 May 2018 at 03:32:25 UTC, Uknown wrote: `private` is for outside the module. Within the module, private is not applied because D wanted to avoid C++'s `friend` functions. 'private' is "meant" to be part of the implementation of 'the class'. Whereas D makes it part of the

Re: auto: useful, annoying or bad practice?

2018-05-10 Thread KingJoffrey via Digitalmars-d
On Monday, 30 April 2018 at 21:11:07 UTC, Gerald wrote: So I'm curious, what's the consensus on auto? My rule, is when I can't be bothered typing it all out, or can't be bothered working out what it is I'm actually meant to type, then I use auto (or var). i.e. I use it as a time saver,

Re: Sealed classes - would you want them in D?

2018-05-10 Thread KingJoffrey via Digitalmars-d
On Thursday, 10 May 2018 at 21:26:12 UTC, Jonathan M Davis wrote: Idiomatic D tends to use classes rarely... What is the basis for this assertion? On a separate issue, 'private' should mean private! (not kinda-private). Let's not make D classes even more of joke.

  1   2   >