Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. The Lounge
  3. Language + ? = BFF

Language + ? = BFF

Scheduled Pinned Locked Moved The Lounge
csharpc++javagraphicstutorial
44 Posts 13 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • OriginalGriffO OriginalGriff

    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!

    V Offline
    V Offline
    Vikram A Punathambekar
    wrote on last edited by
    #27

    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.

    P 1 Reply Last reply
    0
    • S Single Step Debugger

      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.

      K Offline
      K Offline
      kmoorevs
      wrote on last edited by
      #28

      Basic = Dim! :laugh:

      "Go forth into the source" - Neal Morse "Hope is contagious"

      1 Reply Last reply
      0
      • V Vikram A Punathambekar

        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.

        P Offline
        P Offline
        PIEBALDconsult
        wrote on last edited by
        #29

        Maybe there should be an option, perhaps something like strict.

        1 Reply Last reply
        0
        • A Amarnath S

          Javascript - "undefined". :-)

          P Offline
          P Offline
          PIEBALDconsult
          wrote on last edited by
          #30

          Visual Basic -- nothing Mmm, yeah, quite literally.

          1 Reply Last reply
          0
          • P PIEBALDconsult

            enums are also way better in .net languages.

            0 Offline
            0 Offline
            0x01AA
            wrote on last edited by
            #31

            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. ;)

            P 1 Reply Last reply
            0
            • 0 0x01AA

              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. ;)

              P Offline
              P Offline
              PIEBALDconsult
              wrote on last edited by
              #32

              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.

              0 1 Reply Last reply
              0
              • P PIEBALDconsult

                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.

                0 Offline
                0 Offline
                0x01AA
                wrote on last edited by
                #33

                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 ;)

                P 1 Reply Last reply
                0
                • 0 0x01AA

                  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 ;)

                  P Offline
                  P Offline
                  PIEBALDconsult
                  wrote on last edited by
                  #34

                  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.

                  1 Reply Last reply
                  0
                  • D David ONeil

                    Quote:

                    What single structure or specific operator better defines a given language?

                    That was your question. template, virtual, and class are all better answers than vector. In fact, vector is an idiotic answer to that specific question. Especially since vector 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

                    S Offline
                    S Offline
                    Single Step Debugger
                    wrote on last edited by
                    #35

                    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.

                    D 1 Reply Last reply
                    0
                    • 0 0x01AA

                      STL map is pretty ok, but you need to know how to use it....

                      S Offline
                      S Offline
                      Single Step Debugger
                      wrote on last edited by
                      #36

                      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.

                      1 Reply Last reply
                      0
                      • H honey the codewitch

                        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.

                        S Offline
                        S Offline
                        Single Step Debugger
                        wrote on last edited by
                        #37

                        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.

                        H 1 Reply Last reply
                        0
                        • S Single Step Debugger

                          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.

                          H Offline
                          H Offline
                          honey the codewitch
                          wrote on last edited by
                          #38

                          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.

                          1 Reply Last reply
                          0
                          • P PIEBALDconsult

                            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. :mad:

                            J Offline
                            J Offline
                            jschell
                            wrote on last edited by
                            #39

                            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.

                            P 1 Reply Last reply
                            0
                            • S Single Step Debugger

                              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.

                              D Offline
                              D Offline
                              David ONeil
                              wrote on last edited by
                              #40

                              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. :doh: :doh: :doh:

                              Our Forgotten Astronomy | Object Oriented Programming with C++ | Wordle solver

                              S 1 Reply Last reply
                              0
                              • J jschell

                                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.

                                P Offline
                                P Offline
                                PIEBALDconsult
                                wrote on last edited by
                                #41

                                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.

                                J 1 Reply Last reply
                                0
                                • D David ONeil

                                  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. :doh: :doh: :doh:

                                  Our Forgotten Astronomy | Object Oriented Programming with C++ | Wordle solver

                                  S Offline
                                  S Offline
                                  Single Step Debugger
                                  wrote on last edited by
                                  #42

                                  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.

                                  D 1 Reply Last reply
                                  0
                                  • S Single Step Debugger

                                    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.

                                    D Offline
                                    D Offline
                                    David ONeil
                                    wrote on last edited by
                                    #43

                                    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

                                    1 Reply Last reply
                                    0
                                    • P PIEBALDconsult

                                      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.

                                      J Offline
                                      J Offline
                                      jschell
                                      wrote on last edited by
                                      #44

                                      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.)

                                      1 Reply Last reply
                                      0
                                      Reply
                                      • Reply as topic
                                      Log in to reply
                                      • Oldest to Newest
                                      • Newest to Oldest
                                      • Most Votes


                                      • Login

                                      • Don't have an account? Register

                                      • Login or register to search.
                                      • First post
                                        Last post
                                      0
                                      • Categories
                                      • Recent
                                      • Tags
                                      • Popular
                                      • World
                                      • Users
                                      • Groups