What emoji can you put in class names in your language?
I just discussed with a developer about naming classes in C #. My last catchy line was "Don't put emoticons in our class names."
I can't think of how you could place emoticons in C # class names, but I haven't thought too much about it. Is it possible?
Does any programming language allow? What would be the best / worst language to accomplish this?
Update: The schema answer answers my question. It was a quick idea after a quick discussion, so I'm going to accept in a short time and then get on with my life. Thanks for answers.
source to share
C # supports any Unicode letter for identifiers, so if you find suitable emoji in Unicode tables, you can use them. The CLR itself allows a lot more characters in identifier names, such as the typical backtracking used in compiler generated names, so you might get really crazy setting really weird names in MSIL and then loading the classes with reflection in C # because it doesn't support these characters ...
Let's recall the name of the method oO
. It is very smiley (small and big eyes), but when you call it expands links to thought bubble: .oO(Hello)
.
source to share
Slightly off-topic: I was handling filenames the other day and realized all sorts of faces appeared in my code:
string number(fn.begin()+fn.rfind('_')+1,fn.begin()+fn.rfind('.'));
And of course, there are right-to-left emojis that you almost always get at the end of lines of C ++ code:
mesh->Delete();
Why does C ++ look so sad?
source to share
In C ++, if you named class / struct _
(bad decision, but here we go), you can get this out of it:
struct emoticon_to_the_right_of_this :_{
};
Thinking about it, the class o
might be just as good:
struct another_emoticon_to_the_right_of_this :o{
};
Hm. I think I'm just making up sad ones. Is this Freud guy here today? I have a question to ask him ...
source to share
Perl uses ::
package names as a separator, which means the IM client might decide to insert a smiley when I say XML::Parser
(contains ": P") or Data::Dumper
(contains ": D"). Punctuation other than ::
is not recommended in package names, so most of the "extended" smileys are not visible, but if I wanted to be really stupid I could refer to a named variable ${ ':-)' }
- but it would always have to be referenced using the syntax ${'...'}
, since it is not a recognizable identifier name :)
source to share
Not strictly class names, but there are a few that appear in PHP from time to time, such as the single-quoted underscore when concatenating:
$foo = $bar.'_'.$baz;
And as someone else pointed out, you don't even need special characters for some of them:
class o_0 {}
class v_v {}
class T_T {}
Something more confusing:
function d() { echo 'Thumbs up!!'; }
d('_');
source to share