November 22, 2018 Re: How high level is D? | ||||
---|---|---|---|---|
| ||||
Posted in reply to NoMoreBugs | On Thu, 22 Nov 2018 00:14:40 +0000, NoMoreBugs wrote:
> Your constant attacks on me for not liking D's leaking class abstraction is a reflection of *your attitude* towards me.
The "attacks" are because of sock-puppetry surrounding your position, not because of your position.
|
November 22, 2018 Re: How high level is D? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Neia Neutuladh | On Thursday, 22 November 2018 at 01:27:33 UTC, Neia Neutuladh wrote:
> On Thu, 22 Nov 2018 00:14:40 +0000, NoMoreBugs wrote:
>> Your constant attacks on me for not liking D's leaking class abstraction is a reflection of *your attitude* towards me.
>
> The "attacks" are because of sock-puppetry surrounding your position, not because of your position.
I should not be subjected to these constant unfounded accusations of sock-puppetry (which is a means of deception) every time someone expresses a view that is similar to a view that I've expressed.
What this tells me, is that (certain) people on these forums simply don't like the view that is being expressed.
That tactic is actually well known, and sadly, often successful (cause most people are too dumb to realize what's going on).
It's called.. meat-puppetry - where a person or persons intentionally interject into a discussion they do not agree with, not to constructively represent their view, but to generate 'buzz' to sway opinion and ultimately close down the discussion (cause they don't like or don't agree with the discussion).
And btw, your user-handle can be seen doing just that, every time this topic comes up.
|
November 22, 2018 Re: How high level is D? | ||||
---|---|---|---|---|
| ||||
Posted in reply to bmelo | On Wednesday, 21 November 2018 at 09:56:16 UTC, bmelo wrote: > Hi people, I’m new to D and I am curious about how high level is D compared to another languages. I have a list of what languages to compare and I wanna know where you would classify D among them. > The languages are: C, C++, Objective-C, D, Go, Swift, Pascal, Fortran, BASIC, Cobol, C#, Forth and Java. > > When I talk about low and high level language I’m referring to how much control the language gives to the hardware and what has more abstraction levels. Hello there, I'm not able to comment on the hypothesis illustrated due to lack of expertise but here is a picture suggested by c2lang.org. However, I can't find the exact source so I'm posting here the french article dealing about une new implementation of C (i.d. C2) who used the visual comparison of several but not all languages's abstraction levels: https://www.developpez.com/actu/185979/C2-un-langage-qui-se-presente-comme-une-evolution-de-C-plus-rapide-sans-fichiers-d-en-tete-avec-systeme-de-build-integre-et-d-autres-changements/ You can directly look at the picture if it's more convenient for you: https://www.developpez.com/public/images/news/C201.png Please notice it doesn't involve all programming languages you are looking for a comparison but I hope it helps you a bit. It was posted on 2018/02/01. |
November 22, 2018 Re: How high level is D? | ||||
---|---|---|---|---|
| ||||
Posted in reply to NoMoreBugs | On Thursday, 22 November 2018 at 00:14:40 UTC, NoMoreBugs wrote: > (2) - its' completely unlike what a C++/Java/C# programmer would expect (the 3 most widely used languages). > > If (2) weren't also fact, I would not feel inclined to mention it. You can leave Java out of this list though. The following Java code will compile and run: ------------------------------ public class Main { private int _mainMember = 0; public static class InnerData { private int _innerDataMember = 1; } public static class InnerAccess { public void accessMembers(Main main, InnerData innerData) { System.out.println("Outer member from inner: " + main._mainMember); System.out.println("Other class member from same level: " + innerData._innerDataMember); } } public static void main(String[] args) { Main main = new Main(); InnerData innerData = new InnerData(); InnerAccess innerAccess = new InnerAccess(); System.out.println("Inner member from outer: " + innerData._innerDataMember); innerAccess.accessMembers(main, innerData); } } ------------------------------ It goes unnoticed since Java forces you to have one top-level class per module, but Java treats `private` exactly like D: at the module level. Within that module, any class can access any member from any other class, no matter if ti's marked as `private`. |
November 22, 2018 Re: How high level is D? | ||||
---|---|---|---|---|
| ||||
Posted in reply to NoMoreBugs | On Thursday, 22 November 2018 at 00:14:40 UTC, NoMoreBugs wrote:
> (1) - it's just plain fact (i.e. the private state of a class, within a module, is not really private at all)
>
> (2) - its' completely unlike what a C++/Java/C# programmer would expect (the 3 most widely used languages).
Encapsulation is usually used to provide interface to library consumers, it doesn't serve much purpose inside the library. AFAIK java has a restriction 1 class per file, which would work the same in D, in C# it's also a recommended convention. Also there's a use case when a class has a lazily initialized field that shouldn't be accessed directly, but through a property, but there's no way to do it because the class can access its private fields, traditional access attributes won't save you there.
|
November 22, 2018 Re: How high level is D? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Laurent Tréguier | On Thu, 22 Nov 2018 08:13:13 +0000, Laurent Tréguier wrote: > On Thursday, 22 November 2018 at 00:14:40 UTC, NoMoreBugs wrote: >> (2) - its' completely unlike what a C++/Java/C# programmer would expect >> (the 3 most widely used languages). >> >> If (2) weren't also fact, I would not feel inclined to mention it. > > You can leave Java out of this list though. The following Java code will compile and run: I pointed that out ages ago (multiple times) and the person just ignored it. > It goes unnoticed since Java forces you to have one top-level class per module, but Java treats `private` exactly like D: at the module level. Within that module, any class can access any member from any other class, no matter if ti's marked as `private`. Java can have multiple top-level classes per source file, but only one can be public. You can't access private variables from a different top-level class in the same source file. |
November 22, 2018 Re: How high level is D? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Neia Neutuladh | On Thursday, 22 November 2018 at 16:05:28 UTC, Neia Neutuladh wrote:
> On Thu, 22 Nov 2018 08:13:13 +0000, Laurent Tréguier wrote:
>> On Thursday, 22 November 2018 at 00:14:40 UTC, NoMoreBugs wrote:
>>> [...]
>>
>> You can leave Java out of this list though. The following Java code will compile and run:
>
> I pointed that out ages ago (multiple times) and the person just ignored it.
>
>> It goes unnoticed since Java forces you to have one top-level class per module, but Java treats `private` exactly like D: at the module level. Within that module, any class can access any member from any other class, no matter if ti's marked as `private`.
>
> Java can have multiple top-level classes per source file, but only one can be public. You can't access private variables from a different top-level class in the same source file.
It is just some young kid trolling, ignore them.
bye,
Norm
|
November 23, 2018 Re: How high level is D? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Laurent Tréguier | On Thursday, 22 November 2018 at 08:13:13 UTC, Laurent Tréguier wrote: > On Thursday, 22 November 2018 at 00:14:40 UTC, NoMoreBugs wrote: >> (2) - its' completely unlike what a C++/Java/C# programmer would expect (the 3 most widely used languages). >> >> If (2) weren't also fact, I would not feel inclined to mention it. > > You can leave Java out of this list though. The following Java code will compile and run: > > ------------------------------ > public class Main > { > private int _mainMember = 0; > > public static class InnerData > { > private int _innerDataMember = 1; > } > > public static class InnerAccess > { > public void accessMembers(Main main, InnerData innerData) > { > System.out.println("Outer member from inner: " + main._mainMember); > System.out.println("Other class member from same level: " + innerData._innerDataMember); > } > } > > public static void main(String[] args) > { > Main main = new Main(); > InnerData innerData = new InnerData(); > InnerAccess innerAccess = new InnerAccess(); > > System.out.println("Inner member from outer: " + innerData._innerDataMember); > innerAccess.accessMembers(main, innerData); > } > } > ------------------------------ > > It goes unnoticed since Java forces you to have one top-level class per module, but Java treats `private` exactly like D: at the module level. Within that module, any class can access any member from any other class, no matter if ti's marked as `private`. Actually that is wrong, it is one PUBLIC class per module. public class Main { private int _mainMember = 0; public static void main(String[] args) { Main main = new Main(); InnerData innerData = new InnerData(); InnerAccess innerAccess = new InnerAccess(); System.out.println("Inner member from outer: " + innerData._innerDataMember); innerAccess.accessMembers(main, innerData); } } class InnerData { private int _innerDataMember = 1; } class InnerAccess { public void accessMembers(Main main, InnerData innerData) { System.out.println("Outer member from inner: " + main._mainMember); System.out.println("Other class member from same level: " + innerData._innerDataMember); } } Main.java:11: error: _innerDataMember has private access in InnerData System.out.println("Inner member from outer: " + innerData._innerDataMember); ^ Main.java:25: error: _mainMember has private access in Main System.out.println("Outer member from inner: " + main._mainMember); ^ Main.java:26: error: _innerDataMember has private access in InnerData System.out.println("Other class member from same level: " + innerData._innerDataMember); |
November 23, 2018 Re: How high level is D? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Paulo Pinto | On Friday, 23 November 2018 at 07:26:28 UTC, Paulo Pinto wrote:
>
> Actually that is wrong, it is one PUBLIC class per module.
>
> [...]
>
> Main.java:11: error: _innerDataMember has private access in InnerData
> System.out.println("Inner member from outer: " + innerData._innerDataMember);
>
> ^
> Main.java:25: error: _mainMember has private access in Main
> System.out.println("Outer member from inner: " + main._mainMember);
>
> ^
> Main.java:26: error: _innerDataMember has private access in InnerData
> System.out.println("Other class member from same level: " + innerData._innerDataMember);
Yes, Neia pointed that out too.
My bad, I never knew about this. It does make `private` slightly inconsistent instead, since it doesn't behave exactly the same depending on whether it's in a top-level class or not.
|
Copyright © 1999-2021 by the D Language Foundation