Jump to content
Mike Torrettinni

Function with just underscore _() seems to be valid

Recommended Posts

I noticed this function in gnugettext:

function _(const szMsgId: MsgIdString): TranslatedUnicodeString;

It seems you can name the methods with just underscore, or even multiple of them:

 

procedure _;

procedure ______;

 

Is there any situation when this might trigger some unexpected issues?

 

Wow, Delphi world 🙂

 

 

Share this post


Link to post
19 minutes ago, Mike Torrettinni said:

Is there any situation when this might trigger some unexpected issues?

No.

  • Like 1

Share this post


Link to post

Why do you feel that there might be a problem? The rules for identifiers are well documented. These all meet the rules. 

Share this post


Link to post
2 hours ago, Mike Torrettinni said:

Is there any situation when this might trigger some unexpected issues?

With this info in mind, for bad customers you can start programming like that:

const 
 _ = 1;
 _____ = 2;

x =   _____                                   + 
     (_-_-_)                                  +
        0                                     +
     _+0-0+_                                  ;

 

Edited by Vandrovnik
  • Like 1
  • Haha 10

Share this post


Link to post
16 hours ago, Vandrovnik said:

With this info in mind, for bad customers you can start programming like that:


const 
 _ = 1;
 _____ = 2;

x =   _____                                   + 
     (_-_-_)                                  +
        0                                     +
     _+0-0+_                                  ;

 

Who said that Delphi couldn't look like C++ :classic_cool:

  • Haha 1

Share this post


Link to post
Guest
18 hours ago, dummzeuch said:

We have Delphi, we don't need no fchking brainf*ck or whitespace.

Never saw Brainfuck. Methinks it's kinda cool.

Take Neil Stephenson's Diamond Age and you should be able to express the princess educational story's in Brainfuck.

At least the ones with the mice and the chain.

 

Also, we could introduce another variable naming conv;

 

if an identifier start with _, the values assigned to it will be multiplied with the number of _ before the first non _ character.

Then the code snippet above would yield something other than 0.

 

Let's stop here.

Share this post


Link to post
On 5/5/2020 at 11:39 PM, dummzeuch said:

we don't need no fchking brainf*ck or whitespace.

Came just to say it reminds me of BrainF*ck. You were faster though 🙂

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×