Re: Capabilities interact nicely with Substructural Types and Reactivity

[email protected]
Newsgroups gmane.comp.capabilities.general
Message-ID <16308874-1379004082-cardhu_decombobulator_blackberry.rim.net-1058548447-@b14.c9.bise6.blackberry>
Pardon the top-post...

Someone shoot my down if I'm off in the weeds here, but I'm pretty sure you can get the equivalent of a private constructor in javascript by doing the following , which boils down to having the constructor check if the caller to the factory is on the clist (a public method). If so, call the callee's private factory method (an internal anonymous function), else return/throw an exception indicating you aren't on a clist to do that. Commented conceptual pseudo code as my js is quite rusty, and has some type annotations that I know aren't in js:

public new Constructor foo(private new ObjectType bar = caller.Parent.self.class(), <other_stuff_constructor_needs>) {
   if (bar.Parent() in foo.clist()) {
      return new FooFactory foo.internalFactory() ; # or whatever gets you this, a private
      } else {
      throw new NotInClistFactoryException;
      };

I know I've seen a non-capability implementation of this pattern SOMEWHERE in the last decade. The actual constructor's factory method need's to be an anonymous, dynamically created (hence effectively private) function that's only called if the caller should be allowed to create such objects. That's the important crux of the js pattern.

-David Mercer

David Mercer
Portland, OR


-----Original Message-----
From: "Karp, Alan H" <[email protected]>
Sender: [email protected]
Date: Thu, 12 Sep 2013 15:05:21 
To: General discussions concerning capability systems.<[email protected]>
Reply-To: "General discussions concerning capability systems."
	<[email protected]>
Subject: Re: [cap-talk] Capabilities interact nicely with Substructural
 Types	and Reactivity

_______________________________________________
cap-talk mailing list
[email protected]
http://www.eros-os.org/mailman/listinfo/cap-talk
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.