Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

adds prototype of capabilities decorator #23

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

willemolding
Copy link
Collaborator

  • Replaces @zome_function decorator with @capability('capabilityName')
  • Correctly creates multiple capability directories and jsons which are detected by the holochain core

Closes #22

@willemolding
Copy link
Collaborator Author

willemolding commented Oct 12, 2018

How do we like this as an example? It feels pretty good to me but seems kind of awkward that a single typo can create a whole new capability.

Another idea might be to use namespaces to represent capabilities e.g.

@capability
namespace main {
  function zomeFunction1() {}
  function zomeFunction2() {}
}

This would reduce the number of decorators needed and eliminate the @zome_function one entirely as all functions in a capability namespace would be zome functions

@@ -0,0 +1,48 @@
"use strict";

var _testHelper = require("./test-helper");
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How come this file is added?

@@ -85,7 +85,7 @@ mod tests {
#[test]
fn test_init_globals() {
let mut hc = setup_hc();
let globals_result = hc.call("three", "main", "test_init_globals", "");
let globals_result = hc.call("three", "other_capability", "test_init_globals", "");
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file shouldn't exist anymore...

Copy link
Collaborator

@Connoropolous Connoropolous left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like your other suggestion too, but I feel good about just going with this for now, and trying it

@Connoropolous Connoropolous added this to In progress in by DevCamp? Oct 13, 2018
@@ -13,7 +13,7 @@ import {

/*---------- Public Functions ----------*/

@zome_function
@capability('main')
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Dept. of Names Dept. Q: does it make more sense to describe each of these functions as a "capability" or a "zome function"? I like that calling the decorator capability makes it clear what the argument should be, but using @zomeFunction(capabilityName) makes more sense to me with regard to what it actually is decorating.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Willem and I were just chatting, and his latest thought was this...

@capability('agent')
namespace main {
...
}

where multiple zome functions are defined within the namespace. agent refers to the access membrane

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
by DevCamp?
  
In progress
Development

Successfully merging this pull request may close these issues.

None yet

3 participants