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

Namespaces #337

Merged
merged 67 commits into from Jan 5, 2019

Conversation

Projects
None yet
2 participants
@emilypi
Copy link
Contributor

emilypi commented Dec 4, 2018

This addresses #56.

  • Wire up the table information for namespacing
  • Define the define-keyset native fun
  • Define namespace native fun (setting namespace in the eval state)
  • Add support for FQN dot-notation accessors (See Stuart's comment)
Show resolved Hide resolved src/Pact/Eval.hs
@@ -122,7 +122,7 @@ moduleNotFoundP = MP.string "<interactive>:"
*> digitsP *> MP.char ':'
*> digitsP *> MP.char ':'
*> MP.string " Module \""
*> fmap (ModuleName . T.pack) (MP.some $ MP.notChar '"')
*> fmap (\n -> ModuleName (T.pack n) Nothing) (MP.some $ MP.notChar '"')

This comment has been minimized.

@emilypi

emilypi Dec 6, 2018

Author Contributor

This is remote stuff, so i'm not sure how we can get namespaces here. Must discuss

@@ -122,7 +122,7 @@ moduleNotFoundP = MP.string "<interactive>:"
*> digitsP *> MP.char ':'
*> digitsP *> MP.char ':'
*> MP.string " Module \""
*> fmap (ModuleName . T.pack) (MP.some $ MP.notChar '"')
*> fmap (\a -> ModuleName (T.pack a) Nothing) (MP.some $ MP.notChar '"')

This comment has been minimized.

@emilypi

emilypi Dec 28, 2018

Author Contributor

This is something I'd like the folks handling the remote stuff to take a look at

This comment has been minimized.

@slpopejoy

slpopejoy Jan 3, 2019

Contributor

Let's create a dedicated issue for this

This comment has been minimized.

@emilypi

emilypi Jan 3, 2019

Author Contributor

Done here: #350

This comment has been minimized.

@emilypi

emilypi Jan 4, 2019

Author Contributor

This is actually breaking a test I think - we'll discuss tomorrow

Show resolved Hide resolved src/Pact/Native/Internal.hs Outdated

emilypi added some commits Dec 28, 2018

@@ -122,7 +122,7 @@ moduleNotFoundP = MP.string "<interactive>:"
*> digitsP *> MP.char ':'
*> digitsP *> MP.char ':'
*> MP.string " Module \""
*> fmap (ModuleName . T.pack) (MP.some $ MP.notChar '"')
*> fmap (\a -> ModuleName (T.pack a) Nothing) (MP.some $ MP.notChar '"')

This comment has been minimized.

@slpopejoy

slpopejoy Jan 3, 2019

Contributor

Let's create a dedicated issue for this

@@ -231,15 +241,13 @@ literals =
<|> objectLiteral


-- | User-available atoms (excluding reserved words).
-- | Qualified or unqualified user-available atoms (excluding reserved words).

This comment has been minimized.

@slpopejoy

slpopejoy Jan 3, 2019

Contributor

Inaccurate, bare only

This comment has been minimized.

@emilypi

emilypi Jan 3, 2019

Author Contributor

Fixed - thanks

Show resolved Hide resolved src/Pact/Eval.hs

enforcePolicy info ns = do
NamespacePolicy{..} <- view eeNamespacePolicy
if _nsPolicy (Just ns) then pure ()

This comment has been minimized.

@slpopejoy

slpopejoy Jan 3, 2019

Contributor

use unless

Show resolved Hide resolved src/Pact/Native.hs
Show resolved Hide resolved src/Pact/Native/Internal.hs Outdated
Show resolved Hide resolved src/Pact/Types/Gas.hs Outdated
}
makeLenses ''NamespacePolicy

defaultNamespacePolicy :: NamespacePolicy

This comment has been minimized.

@slpopejoy

slpopejoy Jan 3, 2019

Contributor

let's rename this PermissiveNamespacePolicy instead of default, since it shows up in a lot of places naming is important -- it's not a "default" in our production code

} -- deriving (Eq,Show)
makeLenses ''EvalEnv



-- | Dynamic storage for namespace-loaded modules, and new modules compiled in current tx.
data RefState = RefState {
-- | Namespace-local defs.
-- | Imported Module-local defs and natives.
-- TODO: Name -> Text

This comment has been minimized.

@slpopejoy

slpopejoy Jan 3, 2019

Contributor

TODO is done no?

, _nativeFun :: forall m . Monad m => FunApp -> [Term Ref] -> m (Gas,Term Name)
} deriving (Typeable)

nativeDFunCons :: Constr

This comment has been minimized.

@slpopejoy

slpopejoy Jan 3, 2019

Contributor

let's make these local to the Data instance

emilypi added some commits Jan 3, 2019

@@ -122,7 +122,7 @@ moduleNotFoundP = MP.string "<interactive>:"
*> digitsP *> MP.char ':'
*> digitsP *> MP.char ':'
*> MP.string " Module \""
*> fmap (ModuleName . T.pack) (MP.some $ MP.notChar '"')
*> fmap (\a -> ModuleName (T.pack a) Nothing) (MP.some $ MP.notChar '"')

This comment has been minimized.

@emilypi

emilypi Jan 3, 2019

Author Contributor

Done here: #350

Show resolved Hide resolved src/Pact/Types/Term.hs Outdated

emilypi added some commits Jan 3, 2019

@slpopejoy slpopejoy merged commit 25943a5 into master Jan 5, 2019

1 of 3 checks passed

continuous-integration/travis-ci/pr The Travis CI build could not complete due to an error
Details
continuous-integration/travis-ci/push The Travis CI build could not complete due to an error
Details
ci/gitlab/feat/56-namespaces Pipeline passed on GitLab
Details

@slpopejoy slpopejoy deleted the feat/56-namespaces branch Jan 5, 2019

@slpopejoy slpopejoy referenced this pull request Feb 21, 2019

Closed

Namespaces #56

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.