sketchucation logo sketchucation
    • Login
    🛣️ Road Profile Builder | Generate roads, curbs and pavements easily Download

    Ruby :symbols

    scheduled pinned locked moved Developers' Forum
    3 Posts 2 Posters 163 Views 2 Watching
    loading-more-posts
    • oldest-to-newest
    • newest-to-oldest
    • most-votes
    reply
    • reply-as-topic
    guest-login-reply
    deleted-message
    • M Offline
      MartinRinehart
      last edited by

      I have googled and read much on the subject of :symbols in Ruby. I strongly suspect that most of what I have read is off target, if not just plain wrong. There is some strong relationship between names in a Ruby program, and symbols, but I don't know exactly what.

      Enlightenment?

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

      one-reply-to-this-post last-reply-time reply quote 0
      • thomthomT Offline
        thomthom
        last edited by

        What is off target and plain wrong?

        As far as I understood symbols - they are more efficient than strings to use in for instance when you make hash keys.
        I found this one an interesting read: http://www.randomhacks.net/articles/2007/01/20/13-ways-of-looking-at-a-ruby-symbol

        Thomas Thomassen — SketchUp Monkey & Coding addict
        List of my plugins and link to the CookieWare fund

        one-reply-to-this-post last-reply-time reply quote 0
        • M Offline
          MartinRinehart
          last edited by

          @thomthom said:

          What is off target and plain wrong?

          A question I can't answer until I can answer my own question: What's a symbol?

          The link was a good one but after a too-quick read I was better versed in what you could do with symbols that what a symbol was.

          In most languages there is a symbol table, under the covers. Ruby symbols seem to be bringing this capability forward, allowing us to add to the table in some way that I'm not sure I understand. Edit: make that "in some way I'm sure I don't understand." end edit

          Nagging questions: if "foo" is a variable name it will be in the symbol table and :foo will be a symbol. What about "foo.bar"? Is that a :foo plus a :bar, or is it :foo.bar?

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

          one-reply-to-this-post last-reply-time 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