Coder Social home page Coder Social logo

Allow trailing comments about doctest HOT 6 CLOSED

sol avatar sol commented on June 2, 2024
Allow trailing comments

from doctest.

Comments (6)

sol avatar sol commented on June 2, 2024

@kazu-yamamoto I agree that True :: Bool is not important. But I'm not yet sure if we can exclude such cases in general.

Say we have a type class Foo.

class Foo where

instance Foo Int where

And a property p.

p :: Foo a => a -> Bool

Then the user might want to write.

prop> p :: Int -> Bool

Any thoughts?

from doctest.

kazu-yamamoto avatar kazu-yamamoto commented on June 2, 2024

If this is important, we can write:

prop> (p :: Int -> Bool)

I think that we should more flexible one to users. I guess that "$" is more flexible than "()" at this moment.
What do you think?

from doctest.

sol avatar sol commented on June 2, 2024

The user would still need to know about this. How would you document it and make sure that the user actually reads it?

Saying something like "Trailing comments do not work!" is relatively clear.

An other approach would be to strip trailing comments; but we may run into other corner cases here. I'm really not sure what to do here.

from doctest.

kazu-yamamoto avatar kazu-yamamoto commented on June 2, 2024

Just for image:

With trailing comments:
http://mew.org/~kazu/tmp/Data-Set-Splay.html#v:delete

Without trailing comments:
http://mew.org/~kazu/tmp/Data-Set-Splay2.html#v:delete

Which do yo prefer?

BTW, I guess dropping trailing comments is possible but its implementation would be troublesome.

from doctest.

sol avatar sol commented on June 2, 2024

Personally I prefer the second.

In the first, the comments look too much like being part of the property. I think trailing comments could be useful, but only if they get a different layout (e.g. normal font weight, italic, and gray text color). Something similar to this.

prop> xs == ys -- xs always equals ys

That would again require parsing.

I agree that striping trailing comments could be troublesome. The longer I think about it, the less I like it.

So what to do? I'd tend to just document that trailing comments are not supported. What do you think?

from doctest.

kazu-yamamoto avatar kazu-yamamoto commented on June 2, 2024

OK. Let's not allow trailing comments at this moment. We can get back this issue if users actually require.

from doctest.

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.