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

  • Home
  • SEARCH
  • 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 3359676
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T02:54:04+00:00 2026-05-18T02:54:04+00:00

Is there a language which has a feature that can prevent a class accessing

  • 0

Is there a language which has a feature that can prevent a class accessing any other class, unless an instance or reference is contained?

isolated class Example {

    public Integer i;

    public void doSomething()
    {
        i = 5; // This is ok because i belongs to this class

        /*
         * This is forbidden because this class can only
         * access anything  contained within, nothing outside
         */
        System.out.println("This does not work.");
    }
}

[edit]An example use case might be a plugin system. I could define a plugin object with references to certain objects that class can manipulate, but nothing else is permissible. It could potentially make security concerns much easier.[/edit]

  • 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-18T02:54:04+00:00Added an answer on May 18, 2026 at 2:54 am

    I’m not aware of any class-based access modifiers with such intent, but I believe access modifiers to be misguided anyway.

    Capability-based security or, more specifically, the object-capability model seems to be what you want.

    http://en.wikipedia.org/wiki/Object-capability_model

    The basic idea is that in order to do anything with an object, you need to hold a reference to it. Withhold the reference and no access is possible.

    Global things (such as System.out.println) and a few other things are problematic features of a language, because anyone can access them without a reference.

    Languages such as E, or tools like google caja (for Javascript) allow proper object-capability models. Here an example in JS:

    function Example(someObj) {
    
        this.someObj = someObj;
    
        this.doStuff() = function() {
            this.someObj.foo(); //allowed, we have been given a reference to it
            alert("foobar"); //caja may deny/proxy access to global "alert"
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

The R language has a nifty feature for defining functions that can take a
Is there a structured language for declaring styles in a sensible way, which can
Are there any non-research groups or projects which have used the Self language in
Is there a way (a program, a library) to approximately know which language a
Is there a tool (preferably free) which will translate Oracle's PL/SQL stored procedure language
Is there a site like language shootout's (shootout.alioth.debian.org and dada.perl.it/shootout/), which show how to
Are there compilers for high-level languages (such as C) which can be targeted to
If there are any language designers out there (or people simply in the know),
I've noticed that there are awvully few programming tutorials in my native language (Latvian).
I am currently involved in some interesting programming language research which has, up until

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.