|
How big is the tab? Like a bar tab?
|
|
|
|
|
Python 3 doesn't allow mixing tabs and spaces though
But I really wish they had gone with tabs as the preferred option rather than spaces
Cheers,
Vikram.
|
|
|
|
|
Maybe there should be an option, perhaps something like strict .
|
|
|
|
|
These days "." has mutated to "=>". And not in a good way. Like it's been infected with Prolog, or F# or something.
There is only one Vera Farmiga and Salma Hayek is her prophet!
Advertise here – minimum three posts per day are guaranteed.
|
|
|
|
|
My first take on programming language identifiers (not exhaustive by any means)
C *
C++ *
COBOL ADD
COBOL PIC
FORTRAN do
ALGOL begin
PL/I BEGIN
GO func
"A little time, a little trouble, your better day"
Badfinger
|
|
|
|
|
I'd suggest that rather than the List<T> class, C# should be the string class or possibly the whole Generics system itself.
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
"Common sense is so rare these days, it should be classified as a super power" - Random T-shirt
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
No generics in v1.
System.String is dreadful, the unavoidability of immutability is a very short-sighted (ivory tower) idea. They had to include StringBuilder just to make things work. It would be better for strings to be mutable by default and then be able to set them as immutable later as needed -- mystring.AsReadOnly() or mystring.ReadOnly = true
Bleah, ptui. 
|
|
|
|
|
And no vector in C++ V1 either ... languages improve!
But string isn't too bad - it's not perfect, but it is way, way better than the char* / const char * mess that preceded it.
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
"Common sense is so rare these days, it should be classified as a super power" - Random T-shirt
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
OriginalGriff wrote: languages improve
Then it's not the same language.
|
|
|
|
|
Without digging I suspect the string limitation is for the same reason as in Java in that it is not only fundamental to the language but to the VM. Certainly in Java that is the case. If is was mutable then it would lead to problems, in the VM, about things like security and performance.
|
|
|
|
|
rhetorical mode on...
Then explain how StringBuilder works.
Or, better... yet what underlies the VM does not have such a limitation; the VM is written in a language which doesn't rely on the VM. So your point should be more addressed as "why did they choose to implement the VM that way?"
Yes, I understand that something like the .net framework has names of things and names of things must not be mutable, that's perfectly understandable. But making all string values immutable -- particularly values used by an application -- is hitting the issue with too big a hammer.
I'm not qualified to say, but it seems to me that a VM and framework could be implemented such that a string value will be mutable until it is set to immutable, even if that is at compile time.
|
|
|
|
|
PIEBALDconsult wrote: Then explain how StringBuilder works.
Huh? Because it is a different class of course.
Other than that I suggest you look at the Java API source code, which I have. You will find that StringBuilder is entirely written in Java.
PIEBALDconsult wrote: "why did they choose to implement the VM that way?"
Strings are intrinsic part of modern programming languages. That was known before java was created.
Other than that I can only guess that given that the the class file itself would have needed some kind of unique identifier regardless of how it was implemented. So using a String value for that perhaps was just convenient.
PIEBALDconsult wrote: is hitting the issue with too big a hammer.
Yes but that isn't the point. The type 'String' is part of the VM definition. It is not well defined in the specification. For that matter the entirety of the VM/Java specification is not very well done. It still has errors in it today which have existed since the very first version. (For examples of well done specifications look to the ANSI C and C++ specifications.)
But even if it had been better specified it would have been "very short-sighted" to allow it to be mutable.
PIEBALDconsult wrote: that a string value will be mutable until it is set to immutable
At a minimum that would have required at least one and perhaps several features in the Java Spec and VM Spec. I am not even sure it would be possible. I say that because consider how one can access private data members via JNI or even reflection. Certainly with my understanding of security matters I would say that I would not like to see accessing it that way. (I note that I suspect it is possible to hack a C/JNI solution that would allow one to make a String mutable, but it would be VM version dependent and would require an extreme amount of spelunking and would be very difficult to change the length of the string versus just characters in the string.)
|
|
|
|
|
In the desktop/Win32 development I would agree. But in the web development List is making laps around any other generics type, or any other object.
There is only one Vera Farmiga and Salma Hayek is her prophet!
Advertise here – minimum three posts per day are guaranteed.
|
|
|
|
|
That's due to poor developer skills, not because lists are superior.
|
|
|
|
|
There is that too but is not always the case. Some Microsoft technologies/concepts are giving you no choice. EF and MVC come to mind.
There is only one Vera Farmiga and Salma Hayek is her prophet!
Advertise here – minimum three posts per day are guaranteed.
|
|
|
|
|
Which just adds strength to my statement.
|
|
|
|
|
vector for C++ just isn't the right choice, and indicates you are using C++ like C. virtual and template are both far better choices. Depending upon how you use the language, both of them can be supported with valid arguments, so I don't think either of them can be realistically picked over the other.
If you don't understand virtual , see the C++ tutorial in my sig. If you don't understand template , just see any of honey the codewitch's work. C++ becomes magic.
|
|
|
|
|
I wouldn't associate C++ with "virtual". Sure, it's a big part of the language concept, but not defines it. "Virtual" better fits with Java where everything is "virtual" by default. As for the templates, even C++ doesn't fully understand templates - at least until runtime. If you don't understand what I mean, think of separate template implementation and declaration. I know it's doable, but it doesn't feel natural.
There is only one Vera Farmiga and Salma Hayek is her prophet!
Advertise here – minimum three posts per day are guaranteed.
|
|
|
|
|
So the word you are looking for is class . Not vector .
|
|
|
|
|
Again, not verry C++ specific. Same for structures.
There is only one Vera Farmiga and Salma Hayek is her prophet!
Advertise here – minimum three posts per day are guaranteed.
|
|
|
|
|
|
Collections are also structures. You need to spend a little more time learning the basics.
There is only one Vera Farmiga and Salma Hayek is her prophet!
Advertise here – minimum three posts per day are guaranteed.
|
|
|
|
|
So you are one of those annoying contrarians. Gotcha!
As an FYI, the definition of vector in my installation of VS2019 doesn't contain a single struct in the top-level definitions. No, a vector isn't a struct by C++'s definitions. It would be better described as an array of items. Or, to use your own word, a vector is a container.
|
|
|
|
|
hint: Data structures are not the same thing as the C-style structs.
There is only one Vera Farmiga and Salma Hayek is her prophet!
Advertise here – minimum three posts per day are guaranteed.
|
|
|
|
|
You really want to be taken as an arrogant a**hole, evidently. Sorry to hear that. I will start tuning you out.
Best wishes,
David
|
|
|
|