Language + ? = BFF
-
My favorite .NET data structure is
Dictionary<_T_>
hands down. I always found the C++ equivalents (STL'smap
and MFC'sCMap
) somewhat klunkier, mostly because of the template usage and resultant inscrutable compiler diagnostics.Software Zen:
delete this;
enum
s are also way better in .net languages. -
What single structure or specific operator better defines a given language? As an example, I was thinking of: C * C++ - vector C# - List Java - arrays Any other languages or thoughts?
There is only one Vera Farmiga and Salma Hayek is her prophet! Advertise here – minimum three posts per day are guaranteed.
Javascript - "undefined". :-)
-
What single structure or specific operator better defines a given language? As an example, I was thinking of: C * C++ - vector C# - List Java - arrays Any other languages or thoughts?
There is only one Vera Farmiga and Salma Hayek is her prophet! Advertise here – minimum three posts per day are guaranteed.
C++ for me would be
template
I don't really use the STL that much due to working with tiny amounts of RAM.To err is human. Fortune favors the monsters.
-
Python: a tab and three spaces just to annoy people.
"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!
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 X|
Cheers, Vikram.
-
What single structure or specific operator better defines a given language? As an example, I was thinking of: C * C++ - vector C# - List Java - arrays Any other languages or thoughts?
There is only one Vera Farmiga and Salma Hayek is her prophet! Advertise here – minimum three posts per day are guaranteed.
-
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 X|
Cheers, Vikram.
Maybe there should be an option, perhaps something like
strict
. -
Javascript - "undefined". :-)
Visual Basic -- nothing Mmm, yeah, quite literally.
-
enum
s are also way better in .net languages. -
Sorry, the only language I know, which treats enum as enum is Modula2. All languages who allow to assign an enum item a individual value don't treat enum as enum and it should be forbidden that these languages missuse the a type called enum. ;)
Unsure what you are saying. Do you mean the ability to assign a value which isn't defined by the
enum
? I can agree with not liking that. -
Unsure what you are saying. Do you mean the ability to assign a value which isn't defined by the
enum
? I can agree with not liking that.My view, only: enumeration should be only enumeration. Means nobody should have the right to assign a specific value to any member of an enum. enum {theFirst, theSecond} should always end theFirst= 0, theSecond= 1. Even they should not be addressed by an intgeger value. Like it is in e.g. Modula2. And no one should be allowed to define theFirst= 1000 Sorry, I'm not native english and therefore I have problems to express me. [Edit] An enumeration where you can define element0= -100 or whatever and element1= 100 is not an enumeration for me ;)
-
My view, only: enumeration should be only enumeration. Means nobody should have the right to assign a specific value to any member of an enum. enum {theFirst, theSecond} should always end theFirst= 0, theSecond= 1. Even they should not be addressed by an intgeger value. Like it is in e.g. Modula2. And no one should be allowed to define theFirst= 1000 Sorry, I'm not native english and therefore I have problems to express me. [Edit] An enumeration where you can define element0= -100 or whatever and element1= 100 is not an enumeration for me ;)
Ah, I see, but I disagree. I prefer to be able to specify the values. It's kinda important for "flags" type enumerated values. Maybe there should be an Attribute which enables things -- yes, I know about the FlagsAttribute, but it really only affects how strings are formed or parsed, it has nothing to do with what values are defined or assigned.
public enum Option
{
None = 0
,
UTF8 = 1
,
ASCII = 2 | UTF8
,
All = ASCII
}Maybe a "bare"
enum
would enforce a strict value assignment and the ability to specify the values would require the developer to activate other features. -
Quote:
What single structure or specific operator better defines a given language?
That was your question.
template
,virtual
, andclass
are all better answers thanvector
. In fact,vector
is an idiotic answer to that specific question. Especially sincevector
isn't a structure or operator. :doh: :doh: :doh: Of course, neither are the items I've given, but they do define the language.Our Forgotten Astronomy | Object Oriented Programming with C++ | Wordle solver
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.
-
Yes. C++ demands more abstract thinking.
There is only one Vera Farmiga and Salma Hayek is her prophet! Advertise here – minimum three posts per day are guaranteed.
-
C++ for me would be
template
I don't really use the STL that much due to working with tiny amounts of RAM.To err is human. Fortune favors the monsters.
You are lucky you have them. Not all embedded systems' compilers support templates (for example some Verifone proprietary systems).
There is only one Vera Farmiga and Salma Hayek is her prophet! Advertise here – minimum three posts per day are guaranteed.
-
You are lucky you have them. Not all embedded systems' compilers support templates (for example some Verifone proprietary systems).
There is only one Vera Farmiga and Salma Hayek is her prophet! Advertise here – minimum three posts per day are guaranteed.
I've had this discussion before, and where I come down on it, is if your compiler doesn't support a major language feature, like template, you don't support the C++ language - you support a C++ subset.
To err is human. Fortune favors the monsters.
-
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()
ormystring.ReadOnly = true
Bleah, ptui. :mad: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.
-
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 singlestruct
in the top-level definitions. No, avector
isn't astruct
by C++'s definitions. It would be better described as an array of items. Or, to use your own word, avector
is a container. :doh: :doh: :doh:Our Forgotten Astronomy | Object Oriented Programming with C++ | Wordle solver
-
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. -
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 singlestruct
in the top-level definitions. No, avector
isn't astruct
by C++'s definitions. It would be better described as an array of items. Or, to use your own word, avector
is a container. :doh: :doh: :doh:Our Forgotten Astronomy | Object Oriented Programming with C++ | Wordle solver
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.
-
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 asshole, evidently. Sorry to hear that. I will start tuning you out. Best wishes, David
Our Forgotten Astronomy | Object Oriented Programming with C++ | Wordle solver