Re: private keyword dont appear to do anything

2017-11-04 Thread Jonathan M Davis via Digitalmars-d-learn
On Saturday, November 04, 2017 11:03:52 Paolo Invernizzi via Digitalmars-d- learn wrote: > On Friday, 3 November 2017 at 23:32:52 UTC, H. S. Teoh wrote: > > [...] > > What's wrong with the introduction of another visibility > attribute that behave like the C++ private? > > Just curious... Well, if

Re: private keyword dont appear to do anything

2017-11-04 Thread Basile B. via Digitalmars-d-learn
On Friday, 3 November 2017 at 12:43:15 UTC, rikki cattermole wrote: Visibility modifiers like private, and public are to the module not the scope. "Symbols with private visibility can only be accessed from within the same module." This is how module based languages work, Pascal has "strict

Re: private keyword dont appear to do anything

2017-11-04 Thread Paolo Invernizzi via Digitalmars-d-learn
On Friday, 3 November 2017 at 23:32:52 UTC, H. S. Teoh wrote: [...] What's wrong with the introduction of another visibility attribute that behave like the C++ private? Just curious... --- Paolo

Re: private keyword dont appear to do anything

2017-11-03 Thread H. S. Teoh via Digitalmars-d-learn
On Fri, Nov 03, 2017 at 05:59:20PM -0600, Jonathan M Davis via Digitalmars-d-learn wrote: > On Friday, November 03, 2017 16:32:52 H. S. Teoh via Digitalmars-d-learn > wrote: > > Perhaps the solution is to go the > > one-overload-set-per-file route, with std/algorithm/package.d > > basically impo

Re: private keyword dont appear to do anything

2017-11-03 Thread Jonathan M Davis via Digitalmars-d-learn
On Friday, November 03, 2017 16:32:52 H. S. Teoh via Digitalmars-d-learn wrote: > Perhaps the solution is to go the > one-overload-set-per-file route, with std/algorithm/package.d basically > importing everything underneath. :-P > > (Shhh, don't tell Andrei, or we'll get another lecture about wa

Re: private keyword dont appear to do anything

2017-11-03 Thread H. S. Teoh via Digitalmars-d-learn
On Fri, Nov 03, 2017 at 04:30:21PM -0600, Jonathan M Davis via Digitalmars-d-learn wrote: > On Friday, November 03, 2017 14:52:22 H. S. Teoh via Digitalmars-d-learn > wrote: [...] > > Arguably, many of these large flat files ought to be split up into > > smaller files. For example, std.algorithm

Re: private keyword dont appear to do anything

2017-11-03 Thread Jonathan M Davis via Digitalmars-d-learn
On Friday, November 03, 2017 14:52:22 H. S. Teoh via Digitalmars-d-learn wrote: > On Fri, Nov 03, 2017 at 05:43:55PM -0400, Steven Schveighoffer via Digitalmars-d-learn wrote: > > On 11/3/17 5:08 PM, Nathan S. wrote: > > > On Friday, 3 November 2017 at 20:01:27 UTC, Jonathan M Davis wrote: > > >

Re: private keyword dont appear to do anything

2017-11-03 Thread H. S. Teoh via Digitalmars-d-learn
On Fri, Nov 03, 2017 at 05:43:55PM -0400, Steven Schveighoffer via Digitalmars-d-learn wrote: > On 11/3/17 5:08 PM, Nathan S. wrote: > > On Friday, 3 November 2017 at 20:01:27 UTC, Jonathan M Davis wrote: > > > Most folks are surprised by this behavior > > > > I found it surprising at first but n

Re: private keyword dont appear to do anything

2017-11-03 Thread Steven Schveighoffer via Digitalmars-d-learn
On 11/3/17 5:08 PM, Nathan S. wrote: On Friday, 3 November 2017 at 20:01:27 UTC, Jonathan M Davis wrote: Most folks are surprised by this behavior I found it surprising at first but now any other way seems absurd to me. None of the benefits of data encapsulation apply to code written five li

Re: private keyword dont appear to do anything

2017-11-03 Thread H. S. Teoh via Digitalmars-d-learn
On Fri, Nov 03, 2017 at 09:08:56PM +, Nathan S. via Digitalmars-d-learn wrote: > On Friday, 3 November 2017 at 20:01:27 UTC, Jonathan M Davis wrote: > > Most folks are surprised by this behavior > > I found it surprising at first but now any other way seems absurd to > me. None of the benefi

Re: private keyword dont appear to do anything

2017-11-03 Thread Nathan S. via Digitalmars-d-learn
On Friday, 3 November 2017 at 20:01:27 UTC, Jonathan M Davis wrote: Most folks are surprised by this behavior I found it surprising at first but now any other way seems absurd to me. None of the benefits of data encapsulation apply to code written five lines away in the same file.

Re: private keyword dont appear to do anything

2017-11-03 Thread Jonathan M Davis via Digitalmars-d-learn
On Friday, November 03, 2017 13:43:15 rikki cattermole via Digitalmars-d- learn wrote: > Visibility modifiers like private, and public are to the module not the > scope. > > "Symbols with private visibility can only be accessed from within the > same module." > > This is how module based languages

Re: private keyword dont appear to do anything

2017-11-03 Thread LunaticWare via Digitalmars-d-learn
On Friday, 3 November 2017 at 12:43:15 UTC, rikki cattermole wrote: Visibility modifiers like private, and public are to the module not the scope. "Symbols with private visibility can only be accessed from within the same module." This is how module based languages work, a bit more useful th

Re: private keyword dont appear to do anything

2017-11-03 Thread rikki cattermole via Digitalmars-d-learn
Visibility modifiers like private, and public are to the module not the scope. "Symbols with private visibility can only be accessed from within the same module." This is how module based languages work, a bit more useful then to the scope approach IMO. An easy mistake to make. https://dla

private keyword dont appear to do anything

2017-11-03 Thread LunaticWare via Digitalmars-d-learn
hello, being new to D i assumed that the private keyword would work as in C++, but writing this code, i excepted it to throw an error at compile time, it appear to not doing anything, is there something i am doing wrong ? -- import std.stdio; class Foo { private int id = 10; } struct