Coder Social home page Coder Social logo

file's People

Contributors

hellerve avatar scolsen avatar timdeve avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

timdeve scolsen

file's Issues

File location is off

As of 0.0.5, relative paths seem to be relative to the path of the library instead of to the current working directory. This needs to be fixed ASAP.

Cheers

"A file can't load itself" error when loading from .carp/libs/

I am new to carp and am seeing the following error when trying to load the library:

A file can't load itself: 'file.carp' at /Users/spencerking/.carp/libs/github.com_COLON_carpentry-org/file/0.0.4/file.carp:1:7.

Please correct me if I am wrong, but it appears the library is expected to have a main.carp file and file.carp would then need to define a File module.

I would be happy to assist with fixing this issue, assuming it is an actual issue and not a mistake on my part.

Edit:
I should probably note, I was unable to get the library to load automatically from git so I cloned it manually.

Cannot use closures in walker functions

As it currently stands, we cannot use closure functions in our walkers. Consider this example (which would be File.contents, but we have to use a hacky workaround to make this work):

(let-do [all-files []]
  (ignore (File.walk "directory" &(fn [f] (Array.push-back! all-files f))))
  (println* &all-files))

You’d expect all-files to contain all the files in a directory here. Sadly, this is not currently the case, instead File.walk will segfault. This is because File.walk is internally implemented in C, and calling a Carp closure from C is currently not supported if it accesses the environment. This is documented in file’s documentation, but can still only be a temporary state of affairs. The current implementation in C lives here.

As I see it, we have two different alternatives here:

  • Wait for Carp to remove this limitation. This will likely be a big change and require a whole lot of rethinking.
  • Rewrite the core of File.walk in Carp, and only use C for system calls. This seems more prudent, but will require us to wrap the filesystem functions we need (ideally a comprehensive set of the functions in sys/stat.h, dirent.h, and sys/types.h, in a different library that this one imports). This legwork will need to be done sooner or later anyway, so I guess we might as well do it ourselves.

Cheers

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.