GithubHelp home page GithubHelp logo

Comments (2)

ararslan avatar ararslan commented on May 26, 2024

This is because the save(path) method is "curried," i.e. it returns a function that accepts an object as input and calls save(path, object). What you see printed in the REPL is due to how Julia names anonymous functions (see the second paragraph of the relevant manual section). That is to say, what you're observing is expected behavior, though it is apparently not actually documented anywhere except in a comment near the line in the code you linked that save behaves this way.

(I'll note as an aside that I'm personally of the opinion that packages shouldn't provide curried methods and it should be up to the user to obtain whatever unclear syntax they want via macros from separate packages. This is admittedly a rather spicy take that I'm sure almost no one agrees with, but it would at least improve the situation you're observing.)

Removing the aforementioned curried method would be a breaking change, so one possible solution here would be to improve the docstring for save by including something along the lines of

"""
    save(file; kwargs...) -> Function

Return an anonymous function that accepts a single argument `x` as
input and returns `save(file, x; kwargs...)`. Note that `x` should
be savable in the given file type; consult the relevant package
documentation for more information.
"""

from fileio.jl.

ararslan avatar ararslan commented on May 26, 2024

Actually, there is an existing issue #324 which discusses this case and removing the curried method was already proposed in that thread. 😄 I'll close this issue and further discussion and can be directed to that thread.

from fileio.jl.

Related Issues (20)

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.