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

Consider using "『』" instead of "「「」」" for string declarations. #81

Closed
antfu opened this issue Dec 18, 2019 · 6 comments
Closed
Labels
punctuation-marks 。「」『』、,“”

Comments

@antfu
Copy link
Member

antfu commented Dec 18, 2019

『』 are used in Traditional Chinese as double quote.

Maybe we can consider using it instead of 「「」」 for string declarations which is a little bit too space consuming.

Ex:

吾有一言。名之曰「聲」。
若「三餘」者。加「聲」以「「黃河流水鳴濺濺。」」。昔之「聲」者。今其是矣。云云。
若「五餘」者。加「聲」以「「燕山胡騎鳴啾啾。」」。昔之「聲」者。今其是矣。云云。
吾有一言。曰「聲」。書之。

to

吾有一言。名之曰「聲」。
若「三餘」者。加「聲」以『黃河流水鳴濺濺。』。昔之「聲」者。今其是矣。云云。
若「五餘」者。加「聲」以『燕山胡騎鳴啾啾。』。昔之「聲」者。今其是矣。云云。
吾有一言。曰「聲」。書之。
@duskmoon314
Copy link

In my poor memory, 『』means 《》.

Someone who know Japanese and Traditional Chinese well may help

@Lesmiscore
Copy link

In Japanese, 『』 is used for nesting 「」s.
But I think it's not wrong (or invalid) to use 『』 for string literals for disambiguation.

@LingDong-
Copy link
Member

Thanks for the proposal! (and your VSCode plugin)

So on one hand I would like to refrain from using more special symbols. I enjoy the philosophy of having only two 「」, and the rest is just Chinese characters. There is a minimalistic quality to it.

Another problem I have with『』is that personally I don't think they look very nice in most fonts. The strokes just look too thin for some reason. And the spacing between them is also overly thin. It looks as if someone simply downscaled a bigger version of the glyph.

On the other hand I think you're right. It does save space. And it does make sense.

Let's consider more on this.

@tiansh
Copy link

tiansh commented Dec 18, 2019

Another candidate may be using some keywords before 「」to mark it as a string, not variable name. 若「五餘」者。加「聲」以文「燕山胡騎鳴啾啾。」。 for example.

@LingDong-
Copy link
Member

@tiansh Thanks! your solution is my favorite one so far.

@satouriko
Copy link

I would personally upvote for the 『』 solution, this will make code snippets seems clearer.
In terms of traditional Chinese convention, I don't think 「「」」 make sense since no one use them in traditional Chinese, especially to represent string literals.
And I don't think "look very nice in most fonts" is a problem, I think they're recognisable enough in most typefaces.

I think a good compromise will be, accept 『』 as the mark to represent string literals (i.e. " in JavaScript), and use for handy escape,for example

『燕山胡騎鳴啾啾。』 => "燕山胡騎鳴啾啾。"
『古有诗云「黃河流水鳴濺濺。」』 => "古有诗云「黃河流水鳴濺濺。」"
文「古有诗云『燕山胡騎鳴啾啾。』」 => "古有诗云『燕山胡騎鳴啾啾。』"

I think 「「」」 is just too verbose.

But how to represent formatted strings, like `${variable}` in JavaScript or f'{variable}' in Python? We need more discussion.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
punctuation-marks 。「」『』、,“”
Projects
None yet
Development

No branches or pull requests

6 participants