Wenyan: Consider using "『』" instead of "「「」」" for string declarations.

Created on 18 Dec 2019  ·  6Comments  ·  Source: wenyan-lang/wenyan

『』 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

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

Most helpful comment

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

All 6 comments

In my poor memory, 『』means 《》.

Someone who know Japanese and Traditional Chinese well may help

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

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.

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

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

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.

Was this page helpful?
0 / 5 - 0 ratings