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. Ruby has its faults...

Ruby has its faults...

Scheduled Pinned Locked Moved The Lounge
questioncsharprubyadobearchitecture
8 Posts 5 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.
  • B Offline
    B Offline
    Brisingr Aerowing
    wrote on last edited by
    #1

    ... but it does have some interesting features, like performing arithmetic on arrays (Aka Lists). If you don't know what I am talking about (Psuedocode):

    List l = [ "item1", "item2", "item3", "item4" ]
    List l2 = l - "item1" # l2 is [ "item2" , "item3", "item4" ]
    List l3 = l + "item5" # l3 is [ "item1" , "item2", "item3", "item4", "item5" ]

    You can also add / subtract other arrays. I decided to replicate this in C# with a custom list class (it inherits from List<T> and adds the operators). Anyone want the code?

    What do you get when you cross a joke with a rhetorical question? The metaphorical solid rear-end expulsions have impacted the metaphorical motorized bladed rotating air movement mechanism. Do questions with multiple question marks annoy you???

    Richard DeemingR M 2 Replies Last reply
    0
    • B Brisingr Aerowing

      ... but it does have some interesting features, like performing arithmetic on arrays (Aka Lists). If you don't know what I am talking about (Psuedocode):

      List l = [ "item1", "item2", "item3", "item4" ]
      List l2 = l - "item1" # l2 is [ "item2" , "item3", "item4" ]
      List l3 = l + "item5" # l3 is [ "item1" , "item2", "item3", "item4", "item5" ]

      You can also add / subtract other arrays. I decided to replicate this in C# with a custom list class (it inherits from List<T> and adds the operators). Anyone want the code?

      What do you get when you cross a joke with a rhetorical question? The metaphorical solid rear-end expulsions have impacted the metaphorical motorized bladed rotating air movement mechanism. Do questions with multiple question marks annoy you???

      Richard DeemingR Offline
      Richard DeemingR Offline
      Richard Deeming
      wrote on last edited by
      #2

      Did you replicate the immutability, or do your operators mutate the list?


      "These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer

      "These people looked deep within my soul and assigned me a number based on the order in which I joined" - Homer

      B 1 Reply Last reply
      0
      • B Brisingr Aerowing

        ... but it does have some interesting features, like performing arithmetic on arrays (Aka Lists). If you don't know what I am talking about (Psuedocode):

        List l = [ "item1", "item2", "item3", "item4" ]
        List l2 = l - "item1" # l2 is [ "item2" , "item3", "item4" ]
        List l3 = l + "item5" # l3 is [ "item1" , "item2", "item3", "item4", "item5" ]

        You can also add / subtract other arrays. I decided to replicate this in C# with a custom list class (it inherits from List<T> and adds the operators). Anyone want the code?

        What do you get when you cross a joke with a rhetorical question? The metaphorical solid rear-end expulsions have impacted the metaphorical motorized bladed rotating air movement mechanism. Do questions with multiple question marks annoy you???

        M Offline
        M Offline
        Marc Clifton
        wrote on last edited by
        #3

        IMO, arithmetic operator overloading is evil, and I see no reason to replace .NET's Remove, RemoveAt, Add, InsertAt and AddRange methods. Of course, the duck-typed advocates love this sort of crap because you can have a function that takes a string, an array, a number, whatever, and "+" will do whatever the interpreter deems appropriate for the types. I will never be comfortable with that kind of madness. Marc

        Latest Article - Merkle Trees Learning to code with python is like learning to swim with those little arm floaties. It gives you undeserved confidence and will eventually drown you. - DangerBunny Artificial intelligence is the only remedy for natural stupidity. - CDP1802

        M L 2 Replies Last reply
        0
        • Richard DeemingR Richard Deeming

          Did you replicate the immutability, or do your operators mutate the list?


          "These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer

          B Offline
          B Offline
          Brisingr Aerowing
          wrote on last edited by
          #4

          I am going to do a rework on it a bit to make it immutable (creating a new list each time).

          What do you get when you cross a joke with a rhetorical question? The metaphorical solid rear-end expulsions have impacted the metaphorical motorized bladed rotating air movement mechanism. Do questions with multiple question marks annoy you???

          Richard DeemingR 1 Reply Last reply
          0
          • B Brisingr Aerowing

            I am going to do a rework on it a bit to make it immutable (creating a new list each time).

            What do you get when you cross a joke with a rhetorical question? The metaphorical solid rear-end expulsions have impacted the metaphorical motorized bladed rotating air movement mechanism. Do questions with multiple question marks annoy you???

            Richard DeemingR Offline
            Richard DeemingR Offline
            Richard Deeming
            wrote on last edited by
            #5

            You might want to look at the Immutable Collections[^] package, rather than building on the existing mutable collections. :)


            "These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer

            "These people looked deep within my soul and assigned me a number based on the order in which I joined" - Homer

            B 1 Reply Last reply
            0
            • M Marc Clifton

              IMO, arithmetic operator overloading is evil, and I see no reason to replace .NET's Remove, RemoveAt, Add, InsertAt and AddRange methods. Of course, the duck-typed advocates love this sort of crap because you can have a function that takes a string, an array, a number, whatever, and "+" will do whatever the interpreter deems appropriate for the types. I will never be comfortable with that kind of madness. Marc

              Latest Article - Merkle Trees Learning to code with python is like learning to swim with those little arm floaties. It gives you undeserved confidence and will eventually drown you. - DangerBunny Artificial intelligence is the only remedy for natural stupidity. - CDP1802

              M Offline
              M Offline
              Mladen Jankovic
              wrote on last edited by
              #6

              If it walks like a duck, and quacks like a duck, it’s probably gonna throw exceptions at runtime.

              GeoGame for Windows Phone | The Lounge Explained In 5 Minutes

              1 Reply Last reply
              0
              • Richard DeemingR Richard Deeming

                You might want to look at the Immutable Collections[^] package, rather than building on the existing mutable collections. :)


                "These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer

                B Offline
                B Offline
                Brisingr Aerowing
                wrote on last edited by
                #7

                I'll look at that. I may end up removing the class instead.

                What do you get when you cross a joke with a rhetorical question? The metaphorical solid rear-end expulsions have impacted the metaphorical motorized bladed rotating air movement mechanism. Do questions with multiple question marks annoy you???

                1 Reply Last reply
                0
                • M Marc Clifton

                  IMO, arithmetic operator overloading is evil, and I see no reason to replace .NET's Remove, RemoveAt, Add, InsertAt and AddRange methods. Of course, the duck-typed advocates love this sort of crap because you can have a function that takes a string, an array, a number, whatever, and "+" will do whatever the interpreter deems appropriate for the types. I will never be comfortable with that kind of madness. Marc

                  Latest Article - Merkle Trees Learning to code with python is like learning to swim with those little arm floaties. It gives you undeserved confidence and will eventually drown you. - DangerBunny Artificial intelligence is the only remedy for natural stupidity. - CDP1802

                  L Offline
                  L Offline
                  Lost User
                  wrote on last edited by
                  #8

                  Marc Clifton wrote:

                  arithmetic operator overloading

                  Aids in abstracting bugs, something which code maintainers really appreciate.

                  Peter Wasser "The whole problem with the world is that fools and fanatics are always so certain of themselves, and wiser people so full of doubts." - Bertrand Russell

                  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