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

Good Day, Can someone confirm what was said at the bottom of this post
I have a 10-field average lap calculator. However, in testing, someone said they normally
Someone can give me short explanation how to create bitmap runtime using GDI/GDI+ and
I have asked the same in a previous topic but someone said that I
I hope someone can assist me with the problem I'm currently experiencing. We have
I have a website where the public can upload JPEGs. Someone from the public
Before someone said that I did not read I may say that I read
I had a language-agnostic discussion with someone in the C++ chat and he said
Someone recently taught me a useful thing: in css you can write the following:
Hi I have followed a tutorial to create and event list in wordpress using

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.