Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 534405
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T09:36:32+00:00 2026-05-13T09:36:32+00:00

Someone said you can have (implementation inheritance) with Rebol using get. So I tried:

  • 0

Someone said you can have (implementation inheritance) with Rebol using get. So I tried:

shape: context [
  x: 0
  y: 0
  draw: func['object][
    probe get object
  ]
]

circle: make shape [
  radius: 10
  draw: get in shape 'draw
]

rectangle: make shape [
  draw: get in shape 'draw
]

I want to pass the object by reference not by value so I pass only the name using ‘Object. But then I have to call it like this

circle/draw 'circle

which is rather lame as I need to repeat the name circle twice while in usual inheritance there is the this keyword which avoid this kind of unatural syntax. Is there a more elegant way ?

Thanks.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T09:36:32+00:00Added an answer on May 13, 2026 at 9:36 am

    There is a self word. At the risk of creating a false sense of certainty about that, I’ll give you an example that presumably does what you want:

    shape: make object! [
        x: 0
        y: 0
        draw: func [object [object!]] [
            probe object
        ]
    ]
    
    circle: make shape [
        radius: 10
        draw: func [] [
            shape/draw self
        ]
    ] 
    
    rectangle: make shape [
        draw: func [] [
            shape/draw self
        ]
    ]
    

    Here we’ve made functions that take zero arguments by calling the base class function with the appropriate “self”

    Beware: like other words, it gets bound…and the binding sticks. This can get tricky once you start working with abstractions…

    selfWordAlias: func [] [
        return 'self
    ]
    
    triangle: make shape [
        draw: func [] [
            shape/draw get selfWordAlias
        ]
    ]
    

    Calling triangle/draw will probably surprise you. You’re in the object method and selfWordAlias returns the word “self”. But the notion of self was captured and bound at the time the selfWordAlias was defined, which was in the global system context. So that’s what you get back.

    There are tools for dealing with this, but make sure you’ve got a firm grip on Scoping in Rebol !

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In a comment on a previous question, someone said that the following sql statement
In a comment on this answer to another question , someone said that they
I've use Moq to mock my repositories . However, someone recently said that they
Someone told me about a C++ style difference in their team. I have my
Someone told me that it's faster to concatenate strings with StringBuilder. I have changed
Someone please correct me if I'm wrong, but parsing a yyyy/MM/dd (or other specific
Someone asked me how familiar I am with VC++ and how familiar I am
Someone told me about swamp diagrams explaning that they were useful to predict code
Someone asked me a question via e-mail about integer partitions the other day (as
Someone left the organisation but before leaving, he locked all the files for an

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.