September 20

On Saturday, 17 September 2022 at 19:58:24 UTC, 0xEAB wrote:

>

On Thursday, 15 September 2022 at 08:40:22 UTC, Dukc wrote:

>

What features could be removed from D if it were up to you?

The (already deprecated) «body» keyword.
BUT: only because it’s already been superseded by «do»

>

Please consider the breakage that would result from the removal

Legacy code (that doesn’t compile without warnings anymore).
Also it’s one step towards more ambiguity (because «do» got several meanings now).

It’s no problem whatsoever when a keyword has multiple meanings if those meanings are reasonably distinct. Best example is in: It serves as a storage class (in parameter), it serves as a precondition contract, and it serves as an operator (in tango with !in).

Sometimes, people complain that static is too overloaded. It means “needs no context” or “runs at compile-time” or “(variable value) survives through calls”.

I’ve gone through all the keywords. Apart from special tokens and fundamental types (except void), there are 36 with a unique semantics and 40 with multiple semantics. Note that those with “unique” are those for which I don’t know of multiple. It could be that I missed some.

The full list:

Keyword Uses Notes
abstract 2 abstract method, abstract class
alias 2 alias, alias – this
align 1
asm 1
assert 2 assert, static assert
auto 2 storage class, auto ref
body 0
bool type
break 1
byte type
case 2 switch – case, goto case
cast 1
catch 1
cdouble type
cent type
cfloat type
char type
class 2 class declaration, anonymous class object
const 2 type ctor, storage class
continue 1
creal type
dchar type
debug 2 debug (v), debug = v
default 2 switch – default, goto default;
delegate 2 lambda introducer, function ptr type
delete 0
deprecated 1
do 2 do – while, function body introducer
double type
else ≥ 4 if – else, static if – else, version – else, debug – else
enum 2 enumeration types, enum values
export 1
extern 1
false 1
final 2 final class, final method
finally 1
float type
for 1
foreach 2 statement, static foreach
foreach_reverse 2 statement, static foreach_reverse
function 2 lambda introducer, function ptr type
goto 2 goto label, goto case/default
idouble type
if 3 statement, static if, template constraint
ifloat type
immutable 2 type ctor, storage class
import 1
in 3 storage class, contract, operator
inout 2 type ctor, storage class
int type
interface 2 interface type declaration, is(T ==interface)
invariant 1
ireal type
is 2 is operator, is expression
lazy 1
long type
macro 0
mixin 2 string mixin, mixin template
module 1
new 1
nothrow 1
null 1
out 2 storage class, contract
override 1
package 2 package declaration, visibility attribute
pragma 1
private 1
protected 1
public 1
pure 1
real type
ref 2 storage class, auto ref
return 2 statement, storage class
scope 2 storage class, scope guards
shared 2 type ctor, storage class
short type
static ≥ 5 static variable, static if, static foreach, inner type/function w/o context, static assert
struct 3 struct type declaration, is(T == struct), unnamed struct components
super 2 super subobject, ctor call
switch 1
synchronized 1
template 2 template, mixin template
this 3 this object, typeof(this), forwarding ctor
throw 2 throw expression, attribute
true 1
try 1
typeid 1
typeof 1
ubyte type
ucent type
uint type
ulong type
union 3 union type declaration, is(T == union), unnamed union components
unittest 2 unit tests, version (unittest)
ushort type
version 2 version (v), version = v
void 2 type, void init
wchar type
while 1 while loop, do – while loop
with 1
__FILE__ special token
__FILE_FULL_PATH__ special token
__MODULE__ special token
__LINE__ special token
__FUNCTION__ special token
__PRETTY_FUNCTION__ special token
__gshared 1
__traits 1
__vector 1
__parameters 1

(Anyone here is free to improve on this list. Use it for whatever you want.)

September 20

On Saturday, 17 September 2022 at 20:08:26 UTC, Dennis wrote:

>

On Saturday, 17 September 2022 at 07:37:24 UTC, Ogi wrote:

>

Non-ASCII characters in identifiers. There is no good reason to use this “feature”, unless your goal is bug-ridden and unmaintainable code.

I don't use non-ASCII identifiers, but you'll have to explain how e.g. using π instead of pi results in bugs or maintenance burden.

It allows for some kind of attacks. You know how ASCII is different from АЅСІІ? The latter is Cyrillic letters.

1 2 3 4 5 6 7 8
Next ›   Last »