Calypso icon indicating copy to clipboard operation
Calypso copied to clipboard

allow accessing C++ symbols that are reserved keywords

Open timotheecour opened this issue 7 years ago • 1 comments

// util.h
void function(int a){}
struct delegate{
  int function=0;
};
// main.d

import _; // won't make clashing symbols available (unless maybe with awkward __traits wizardry)
//import (C++) _ : _function=function; // not legal

We need a more general solution than https://github.com/Syniurge/Calypso/pull/5 How about making each C++ symbol that is a reserved D keyword automatically prepended by § or ?

eg:

import _;
ℂfunction(1);

import _ : _function = ℂfunction;
_function(1);

timotheecour avatar Jan 23 '18 00:01 timotheecour

That's how it should be, getIdentifierOrNull needs to be expanded to prefix with ℂ in more cases. § isn't suitable however, it's easier to type on some keyboards but it's not accepted by the lexer as a valid character in identifiers.

Syniurge avatar Jan 23 '18 00:01 Syniurge