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

Annotations on function definitions and function calls #21

Open
tmcphillips opened this issue Feb 6, 2015 · 2 comments
Open

Annotations on function definitions and function calls #21

tmcphillips opened this issue Feb 6, 2015 · 2 comments

Comments

@tmcphillips
Copy link
Member

YW currently expects nested code blocks to be defined in-line, whereas many scripts are structured as functions (or classes) with a top-level script that calls these functions (or methods on objects). This is a proposal to allow YW users to model function calls as nested code blocks:

Allow function definitions to be marked up with YW comments.

  • These blocks will delimited by @begin and @end comments like other blocks. The name following the @begin keyword is expected to match the name of the function.
  • An @as qualification a code block will allow an alias to be used to refer to the function in YW annotations on calling code.
  • Function definition blocks will not support @in or @out comments. Instead users will employ @param and @return comments (compatible with Javadoc, Doxygen, etc).
  • @as qualifications on the @param and @return comments optionally will provide aliases that may be used by annotations on calling code.

Allow calling code to be marked up as a YW code block.

  • A @calls comment within the block will name the function called.
  • A @binds comment will qualify each @in, @param, or @out annotation that supplies data to or receives data from the function. Each @binds comment will name the corresponding function parameter or return value.

Each function call-definition pair will be represented by YW-Model and YW-Graph as a single code block. If a function includes code blocks (or calls other functions) marked up with YW comments, the former will be represented as a sub-workflow with the latter as its component programs.

@ludaesch
Copy link
Member

ludaesch commented Feb 6, 2015

On Thu, Feb 5, 2015 at 9:21 PM, Timothy McPhillips <notifications@github.com

wrote:

...

  • Function definition blocks will not support @in or @out comments.
    Instead users will employ @param and @return comments (compatible with
    Javadoc, Doxygen, etc).

I like that. This way you get both: a form of backwards compatibility with
Javadoc etc, but also a distinction what is a block with @in and @out
(part of the dataflow model) and what are function parameters and return
values - different beasts!

Will be interesting to think about visualizing the new, enriched model!

  • @as qualifications on the @param and @return comments optionally
    will provide aliases that may be used by annotations on calling code.

Allow calling code to be marked up as a YW code block.

  • A @Calls comment within the block will name the function called.
    • A @BINDS comment will qualify each @in, @param, or @out annotation
      that supplies data to or receives data from the function. Each @BINDS
      comment will name the corresponding function parameter or return value.

Yep. Will need something like that to keep track of the dataflow..

Each function call-definition pair will be represented by YW-Model and
YW-Graph as a single code block. If a function includes code blocks (or
calls other functions) marked up with YW comments, the former will be
represented as a sub]workflow with the latter as its component programs.

Seems reasonable as well


Reply to this email directly or view it on GitHub
#21.

@sycao5
Copy link
Contributor

sycao5 commented Feb 9, 2015

When a function definition block is met during parsing, how to find the file containing this function definition?

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

No branches or pull requests

3 participants