Giter Club home page Giter Club logo

Comments (5)

weavejester avatar weavejester commented on May 13, 2024

Ring is not designed to be a purely functional library, any more than Clojure is. InputStreams are a compromise in the design, but a necessary one, as Clojure has no official I/O library of its own, and lazy seqs lack the performance for dealing with large streams of data.

InputStreams are a bit of a gotcha if you're not familiar with Java's I/O classes, and I'd encourage you to add a page to the wiki to document this potential pitfall. Any GitHub user can edit the wiki; you don't need permission to do so.

It might be possible to write middleware to replace the InputStream with a caching version that can be re-read, without breaking existing functionality. However, this should be tried out as a separate library.

from ring.

Raynes avatar Raynes commented on May 13, 2024

I wasn't implying ring was meant to be purely functional. Doesn't mean it doesn't still feel weird to be bit by mutability hiding under the covers. I am very familiar with Java's I/O classes and I understood how inputstreams worked from the very beginning. A big problem is that I had no idea :body even was an inputstream until I just so happened to look its class up for an unrelated reason.

I can certainly add a wiki page explaining inputstream sematics, but will anybody with this issue actually know what to look for? Is there any point?

from ring.

weavejester avatar weavejester commented on May 13, 2024

Perhaps we should document the symptoms, and then suggest the possible cause.

For instance, perhaps a page of common problems, with a section on blank params and a suggestion that this may be caused by the body of the request being consumed.

I was surprised that you didn't know that the request body was an InputStream. Perhaps that could be more prominently documented.

from ring.

Raynes avatar Raynes commented on May 13, 2024

The specific reason I didn't know that the body was an inputstream was because of its class name. HttpInput. Normally input streams are named like HttpInputStream. That is what put me off.

I think the symptom idea is a good one. I'll get a page started!

from ring.

weavejester avatar weavejester commented on May 13, 2024

Thanks in advance for the help!

from ring.

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.