Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Number: let `inspect` not show the type suffix #7525

Merged
merged 2 commits into from Mar 8, 2019

Conversation

Projects
None yet
6 participants
@asterite
Copy link
Member

commented Mar 8, 2019

Fixes #6196

Also clarifies the difference between to_s and inspect.

I'll repeat it here: the idea of inspect is to give a string representation that's clearly delimited and so it's suitable to be embedded inside other expressions. That's why Array#to_s invokes inspect on each element, because in the case of for example String, to_s doesn't show the quotes but inspect does. inspect has nothing to do with showing something that resembles a Crystal expression, or something that shows types.

If many of you want a way to make it easier to know the types of an object tree then maybe you can open an issue to discuss it. For example the method could check the constructors of an object to maybe create expressions that recreate an object, thought this isn't always possible... but it's an idea. And it probably belongs in a shard (in my opinion).

Finally, my opinion expressed here about me not wanting to continue developing or using Crystal is not a threat, it's just how I feel: why would I use a language that I started which I find ugly and verbose in its output and which doesn't show the clean and beautiful output of Ruby? This is just something I feel super strong about, that's all.

Show resolved Hide resolved src/object.cr Outdated
Show resolved Hide resolved src/object.cr

@asterite asterite force-pushed the asterite:feature/number-inspect branch from 11e2ad7 to ef4c3ec Mar 8, 2019

@RX14

RX14 approved these changes Mar 8, 2019

Copy link
Member

left a comment

It's clear I underestimated how much this issue means to some people. I would like the types to stay, but it doesn't matter that much to me.

I'm fine with the new definition of #inspect, at least it's clear now.

@asterite asterite added this to the 0.28.0 milestone Mar 8, 2019

@asterite

This comment has been minimized.

Copy link
Member Author

commented Mar 8, 2019

Thank you all! ❤️❤️❤️

@asterite asterite merged commit 0be30bc into crystal-lang:master Mar 8, 2019

5 checks passed

ci/circleci: check_format Your tests passed on CircleCI!
Details
ci/circleci: test_darwin Your tests passed on CircleCI!
Details
ci/circleci: test_linux Your tests passed on CircleCI!
Details
ci/circleci: test_linux32 Your tests passed on CircleCI!
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
@ysbaddaden

This comment has been minimized.

Copy link
Member

commented Mar 8, 2019

Thanks! 👏

@straight-shoota

This comment has been minimized.

Copy link
Member

commented Mar 8, 2019

I am a bit surprised how fast this was rushed, but I am ok with the change.

@asterite asterite deleted the asterite:feature/number-inspect branch Mar 30, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.