sketchucation logo sketchucation
    • Login
    ℹ️ Licensed Extensions | FredoBatch, ElevationProfile, FredoSketch, LayOps, MatSim and Pic2Shape will require license from Sept 1st More Info

    Python/Ruby vs. Ruby/Python

    Scheduled Pinned Locked Moved Developers' Forum
    5 Posts 2 Posters 271 Views 2 Watching
    Loading More Posts
    • 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.
    • M Offline
      MartinRinehart
      last edited by

      This is off topic. I'm posting this so that those who want to join the debate will have a place to do so. Hopefully, we'll not have the topic raised elsewhere.

      I have a pet Python named Monty. Monty promises to give Tim Toady a big hug if he ever meets him. (No, you do not want a big hug from Monty.) You can figure out where I stand.

      On the other hand, I know some experienced, productive code weavers who love Tim Toady. Fine. (But don't bring it up around Monty.)

      Python's suites (four-space indented code blocks) are great. They enforce good code writing. Ruby's if/unless pairing, and especially suffixing, are great. Python's lambda functions and Ruby's blocks are no match for the elegant simplicity of JavaScript's functional programming.

      Python lacks the implicit "this" of C++ and Java. It's a pain. Not being able to wrap your code in a module without changing all your def func() to def self.func() is a Ruby pain. And what was Matz thinking when he decided that the programmer, not the language, had to write explicit type coercions? ("foo"+23) == "foo23" in most of the languages I know.

      And I find the processing of code in the order it appears in the file is utterly lame. Even JavaScript has sense enough to eat all the declarative code before it starts running imperative code. Matz? Guido? This is 2010!

      Author, Edges to Rubies - The Complete SketchUp Tutorial at http://www.MartinRinehart.com/models/tutorial.

      1 Reply Last reply Reply Quote 0
      • J Offline
        jessejames
        last edited by

        @martinrinehart said:

        This is off topic. I'm posting this so that those who want to join the debate will have a place to do so. Hopefully, we'll not have the topic raised elsewhere.

        Well Martin you had to know i could not resist a thread with Python in the title, no more than a dog can resist chasing his tail, it's just too damn interesting. 🀣

        @martinrinehart said:

        I have a pet Python named Monty. Monty promises to give Tim Toady a big hug if he ever meets him. (No, you do not want a big hug from Monty.) You can figure out where I stand.

        Another example of Martin's comedic genius, pure gold! πŸ˜†

        @martinrinehart said:

        Python's suites (four-space indented code blocks) are great. They enforce good code writing. Ruby's if/unless pairing, and especially suffixing, are great.

        i love Ruby's one line statements "if condition then statement else statement end". Reminds me of Python list comprehensions. We have something similar now in 3.0

        @martinrinehart said:

        Python lacks the implicit "this" of C++ and Java.

        i'm still out on this one. On one hand (like Guido argues) you see the path of self, but i could live without it.

        @martinrinehart said:

        And I find the processing of code in the order it appears in the file is utterly lame. Even JavaScript has sense enough to eat all the declarative code before it starts running imperative code. Matz? Guido? This is 2010!

        I don't see how that matters but i won't disagree on such a small thing. So Martin, can i surmise your rant as...

        @unknownuser said:

        "The best language today would incorporate everything that is good in Python, Ruby, and Javascript into one beautiful 21st centry language".

        If so i agree, when do we start building this thing? And what the heck are we going to call it? hmm, scratches head, how bout "Full Monty"?

        Always sleep with a loaded gun under your pillow!

        1 Reply Last reply Reply Quote 0
        • M Offline
          MartinRinehart
          last edited by

          @jessejames said:

          @martinrinehart said:

          when do we start building this thing?

          http://www.MartinRinehart.com/posters/decaf.html

          Got a lexer running, tho it's blocks are delimited, not indented. Begun a parser. I only pick on this a bit at a time. (In Python, of course.)

          The declaratives (func defs, classes, etc.) should be processed first so the user can decide that the mainline would best come first or last or where it makes sense. Language design shouldn't dictate source code structure. When I wrote Java, for example, I had one special place for main(). It was important that it always resided in its special place as it was typically test code, commented out when the class was finished. Once commented out, the IDE couldn't see it.

          Author, Edges to Rubies - The Complete SketchUp Tutorial at http://www.MartinRinehart.com/models/tutorial.

          1 Reply Last reply Reply Quote 0
          • J Offline
            jessejames
            last edited by

            @martinrinehart said:

            Got a lexer running, tho it's blocks are delimited, not indented. Begun a parser. I only pick on this a bit at a time. (In Python, of course.)

            Can you show me some code, i like to look over specs only after i see the code in action, specifically the simplistic syntactic elegance of the language in particular. Python is a hard act to follow in this category.

            My idea of the perfect language is Pythons core seasoned lightly with some Ruby, and maybe a very small pinch of Java. πŸ˜‰. But i am open to new ideas also.

            @martinrinehart said:

            Language design shouldn't dictate source code structure. When I wrote Java, for example, I had one special place for main(). It was important that it always resided in its special place as it was typically test code, commented out when the class was finished. Once commented out, the IDE couldn't see it.

            You do know about using Python's...

            If __name__ == '__main__';
                # block here
            

            ...construct to insert tests where ever you like? It's typically used at the end of a script for running tests. It will only run the test when the module is ran directly, not when it is imported, so no need to comment out!

            @martinrinehart said:

            When I wrote Java, for example, I had one special place for main().

            Where is that exactly?

            Always sleep with a loaded gun under your pillow!

            1 Reply Last reply Reply Quote 0
            • M Offline
              MartinRinehart
              last edited by

              Don't think I want to dust off Decaf until I've got time to go after it. I forget where I put my mains in Java. There's tons of my Java on my site: http://www.MartinRinehart.com , including the original Decaf tokenizer.

              There's a whole new vocabulary (words, not tokens; phrases, not expressions; sentences, not statements; etc.) that I'll need to document before anyone could realize that I wasn't just babbling.

              See "The Project", my site, for more.

              Author, Edges to Rubies - The Complete SketchUp Tutorial at http://www.MartinRinehart.com/models/tutorial.

              1 Reply Last reply Reply Quote 0
              • 1 / 1
              • First post
                Last post
              Buy SketchPlus
              Buy SUbD
              Buy WrapR
              Buy eBook
              Buy Modelur
              Buy Vertex Tools
              Buy SketchCuisine
              Buy FormFonts

              Advertisement