GithubHelp home page GithubHelp logo

Comments (9)

nblumhardt avatar nblumhardt commented on July 18, 2024 1

👍 both angles are definitely valid. The current shape of these APIs has been stable for quite a long time now, so I'm leaning more towards favouring completeness and consistency in this case, and exposing all of the interface.

from superpower.

ewoutkramer avatar ewoutkramer commented on July 18, 2024

To be more precise, this is the problematic part:

 failure = new Result<TKind>()(remainder, augmentedMessage, attempt.Expectations, attempt.Backtrack);

It's not unlikely that custom tokenizer would need to augment the error message and position, just like the above statement.

from superpower.

ewoutkramer avatar ewoutkramer commented on July 18, 2024

..and this is what I needed in the end: ewoutkramer@9c2674f

from superpower.

nblumhardt avatar nblumhardt commented on July 18, 2024

Thanks @ewoutkramer - those look like reasonable modifications, I'll take a look at this.

from superpower.

AndrewSav avatar AndrewSav commented on July 18, 2024

I have a different use case that needs Backtrack.

I want to write another combinator, similar to Many. This combinator would accept a lower and an upper bound, similar to regex {n,m}. I want my combinator to conform Many style but I cannot, since Many has access to Backtrack and I don't. @ewoutkramer solution unfortunately will not help that use case.

from superpower.

nblumhardt avatar nblumhardt commented on July 18, 2024

Looking at this again, I wonder if we should consider just making all the internal properties and constructors on Result<T> (and TokenListParserResult<T,U>) public 🤔

I originally steered away from this because I think they're pretty tightly bound to the internal implementation, but in retrospect, making experimentation and add-on development easier seems like a reasonable trade-off.

from superpower.

AndrewSav avatar AndrewSav commented on July 18, 2024

@nblumhardt As a user I support this, because it would allow me to do what I want. I'm not sure if I would be comfortable with it as a designer, but fortunately, I'm not the designer, you are. ;) So I'll leave it up to you.

from superpower.

ewoutkramer avatar ewoutkramer commented on July 18, 2024

As a fellow API designer we all know that you'll be stuck with your public interface for a long time. So, I'd do it just "on demand".

from superpower.

AndrewSav avatar AndrewSav commented on July 18, 2024

It probably does not make sense to open just a single property, if for nothing else, then for consistency reasons. They were designed as a part of an internal "interface" (I do not mean C# interface here, I mean it in more general sense) that we are considering making public here. If we are comfortable with this, it certainly makes sense. I cannot think of better options right now. I also agree, that it helps with experimentation and the longer term library enhancements.

from superpower.

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.