ZoKrates icon indicating copy to clipboard operation
ZoKrates copied to clipboard

Improve importing of symbols

Open dark64 opened this issue 3 years ago • 0 comments

Abstract

Symbol importing logic should be revisited and improved in the future. We currently support the following ways of importing symbols:

// [source: "./module.zok", symbol: "main", alias: file stem = module]
import "./module.zok"

// [source: "./module.zok", symbol: "main", alias: "module"]
import "./module.zok" as module

// [source: "./module.zok", symbol: "main", alias: None]
from "./module.zok" import main    

// [
//    [source: "./module.zok", symbol: "foo", alias: None], 
//    [source: "./module.zok", symbol: "bar", alias: "b"]
// ]
from "./module.zok" import foo, bar as b       

Motivation

We should improve on:

  • Code readability so it's easier to understand the logic
  • Better represent these cases in the AST with the removal of the sugar code
  • Discuss the removal of the legacy import statement?
  • Discuss file stem aliasing and its implications

Backwards Compatibility

Unknown on the date of opening this issue.

dark64 avatar May 17 '21 18:05 dark64