Code Monkey home page Code Monkey logo

tinsel's Introduction

Hello hello

My name's Nathan (Nate) Teetor! I'm an R package developer and aspiring farmer. I live near-ish the city of Himeji. These days my R projects are mostly related to {shiny}. Much of my consulting work is building applications with shiny. So, to improve my workflow and hopefully others' too I am developing a suite of tools for building shiny applications.

Achievements

  • Creator of the {zeallot} package, later invited into the r-lib organization
  • Guest on the Shiny Developer Series, Episode 8
  • Presenter at rstudio::conf(2018)

Only for fun

  • I can't get enough of The Wise Man's Fear
  • Favorite author is most likely Ursula K. Le Guin
  • I wish I'd read/watched Hunter x Hunter sooner

tinsel's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

tinsel's Issues

scanner `expected()` vs parser `expected()`

Within the parser class, the expected() function returns a token if the token was expected, otherwise an error is thrown.

Within scanner expected() was removed from the traversal class, is now part of the scanner class, and behaves similarly to the parser expected function. However, the methods of scanner do not currently utilize the return value of expected(). Reviewing and refactoring scanner to utilize the return value of expected could prove useful.

fix grammar

The current grammar used by the parser does not handle multiple decorators well, if at all.

Documentation Suggestion

You might want to create a vignette and/or modify your description to make it more obvious that decorators operate on source files rather than say in an interactive session. Can tinsel be used in package authorship or is it just for files you would directly source?

backticks, white space, and variable names

When parsing variable names one might safely assume "^\\s*[^ ]+" could do the trick.

However, if a variable is assigned to ` (yep)` or `white space` the regular expression above will fail to parse correctly. I want to believe white space would not get used in a variable name, but the possibility exists.

The problem will not be addressed until numerous complaints flood in.

Syntax for non REPL environments

I tried to use this library in a Shiny environment but is quite complex to integrate the current special comments syntax.

Have a look to this:
https://github.com/klmr/decorator

Maybe it would be great to have both options in only one library.

Another but much more complex solution is to make an environment aware of decorated functions like in data.table. Have no idea how to start this.

scanner statements

  • string literals
  • numeric literals
  • negative numeric literals
  • arguments to decorators
  • assignments

decorators in separate files

The initial release of tinsel (0.0.1), source_decoratees expects decorators to be defined in the same file as their decoratee. Allowing decorators to live in a separate file would be beneficial for the programmer and would allow flexible file organization.

In python one can import a decorator buzz like so,

import bazz

@bazz.buzz
class fizz:
    pass

If we consider using something of this fashion for tinsel the following operators are already used for a similar, but not indentical, task: ::, :::. Using :::: seems excessive: #. bazz::::buzz. Note that there would not be an import bazz equivalent. One could already work around this definition issue using source if they felt inclined to do so.

Is there an alternative symbol we could use?

passing connection to `source_decoratees`

If a connection object is passed to source_decoratees and the connection text references a decorator found in a separate file an error occurs,

source_decoratees(
  textConnection("
    #. fizz$bar
    example <- function() 'minimal'
  ")
)

The immediate error is a result of passing a connection object to dirname(), a character string is expected. The larger issue is connection objects have no information regarding file location. In general they would not need to, but in the case of the new source selection addin the text connection is from a specific file and we need to know which file.

documenting decorated functions

  1. What are best practices for documenting decorated functions?

    • How do other languages handle documenting decorated functions?
  2. How to double check documented decorators against actual function decorators?

    • Add roxygen tag?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.