您可以在您的语言的类名称中添加哪些表情符号?

发布于 2024-08-05 04:35:37 字数 1437 浏览 3 评论 0原文

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(9

听,心雨的声音 2024-08-12 04:35:37

许多日式表情符号 - O_o、v_v 等 - 在大多数语言中都是完全合法的标识符名称子字符串。

Many Japanese-style emoticons - O_o, v_v and the like - are perfectly legal substrings of identifier names in most languages.

离线来电— 2024-08-12 04:35:37

例如,在方案中,您可以灵活地在名称中包含 :-/ ... 等符号,

(define (:-D x)
  (+ x 1))
...

(:-D 9)
output: 10

For example in Scheme you have the flexibility to include symbols like :, -, / ... in the names,

(define (:-D x)
  (+ x 1))
...

(:-D 9)
output: 10
智商已欠费 2024-08-12 04:35:37

C# 支持任何 Unicode 字母作为标识符,因此如果您在 Unicode 表中找到一些适合表情符号的符号,则可以使用它们。 CLR 本身允许在标识符名称中包含更多字符,例如编译器生成的名称中使用的典型反引号,因此在 MSIL 中定义非常奇怪的名称,然后在 C# 中使用反射加载类,可能会变得非常疯狂,因为它不支持这些字符...

我想到了方法名称oO。它本身就是一个表情符号(小眼睛和大眼睛),但是当在引用上调用时,它会扩展为一个思想气泡:.oO(Hello)

C# supports any Unicode letter for identifiers, so if you find some suitable for emoticons in the Unicode tables, you can use them. The CLR itself allows far more characters in identifier names, like the typical backtick used in compiler-generated names, so you could get really crazy by defining really strange names in MSIL, and then loading the classes with reflection in C# because it does not support those characters...

The method name oO comes to mind. It's an emoticon in itself (small and large eye), but when called on a reference, it expands to a thought bubble: .oO(Hello).

尐偏执 2024-08-12 04:35:37

稍微偏离主题:前几天我正在处理文件名,并意识到我的代码中出现了各种各样的面孔:

string number(fn.begin()+fn.rfind('_')+1,fn.begin()+fn.rfind('.'));    

当然,还有从右到左的表情符号,您几乎总是在 C++ 代码行的末尾看到:

mesh->Delete();

为什么C++看起来如此悲伤?

Slightly off-topic: I was processing filenames the other day and realised that all sorts of faces had appeared in my code:

string number(fn.begin()+fn.rfind('_')+1,fn.begin()+fn.rfind('.'));    

And of course there are the right-to-left emoticons you almost always get at the end of lines of C++ code:

mesh->Delete();

Why does C++ look so sad?

无人问我粥可暖 2024-08-12 04:35:37

在 C++ 中,如果您命名一个类/结构 _ (这是一个糟糕的决定,但我们开始吧),您可以像这样从中派生:

struct emoticon_to_the_right_of_this :_{
};

考虑一下,一个类 o > 可能同样好:

struct another_emoticon_to_the_right_of_this :o{
};

嗯。我似乎只想到悲伤的。 那个弗洛伊德家伙今天在这儿吗?我确实有个问题要问他......

In C++, if you name a class/struct _ (a poor decision, but here we go), you can derive from it like this:

struct emoticon_to_the_right_of_this :_{
};

Thinking about this, a class o might be just as good:

struct another_emoticon_to_the_right_of_this :o{
};

Hm. I seem to only come up with sad ones. Is that Freud guy around here today? I do have a question to ask him...

最佳男配角 2024-08-12 04:35:37

Perl 使用 :: 作为包名称分隔符,这意味着当我谈论 XML::Parser(包含“:P”)时,IM 客户端可能会决定插入笑脸) 或 Data::Dumper (包含“:D”)。不建议在包名称中使用 :: 以外的标点符号,因此大多数“扩展”笑脸都不在图片中,但如果我想变得非常愚蠢,我可以引用名为 $ 的变量{ ':-)' } -- 但始终必须使用 ${'...'} 语法引用它,因为它不是可识别的标识符名称:)

Perl uses :: as a package name separator, which means that an IM client might decide to insert a smiley when I talk about XML::Parser (contains ":P") or Data::Dumper (contains ":D"). Punctuation other than :: isn't recommended in package names, so most "extended" smileys are out of the picture, but if I wanted to be very silly I could reference a variable named ${ ':-)' } -- but it would always have to be referenced using the ${'...'} syntax since it's not a recognizable identifier name :)

浮华 2024-08-12 04:35:37

2014 年的此时此刻,苹果昨天刚刚发布了 Swift。我为此做了一个简短的例子。它编译并运行得很好。 :D

Swift

At this moment in 2014, Apple have just released Swift yesterday. And I made a short example for this. It compiles and runs perfectly fine. :D

Swift

独守阴晴ぅ圆缺 2024-08-12 04:35:37

我相信我见过使用 => 访问对象属性的语言(例如 person=>father

它实际上不是名称的一部分,但它可以是一个表情符号。

I believe I've seen languages that use => to access object attributes (something like person=>father)

It's not actually part of the name, but it could be an emoticon.

两相知 2024-08-12 04:35:37

严格来说不是类名,但 PHP 中时不时会出现一些类名,例如连接时单引号中的下划线:

$foo = $bar.'_'.$baz;

正如其他人指出的那样,您甚至不需要其中一些特殊符号:

class o_0 {}
class v_v {}
class T_T {}

更复杂的事情:

function d() { echo 'Thumbs up!!'; }

d('_');

Not strictly class names, but there are a few that pop up in PHP from time to time, like an underscore in single quote when concatenating:

$foo = $bar.'_'.$baz;

And as someone else pointed out, you don't even really need special symbols for some of them:

class o_0 {}
class v_v {}
class T_T {}

Something more convoluted:

function d() { echo 'Thumbs up!!'; }

d('_');
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文