Today's news comes a little early in the day, apropos of nothing. Although the real reason is, the afternoon is cut a little short and I don't know what to expect of that time block, so I'll probably be spending most of it on assessing an implementation path for various features.
This week has pulled me in a few different directions, but I've still kept more focus on the software. Late last week I got some changes in to support using the . operator to properly chain var and proc access after a proc call or a list lookup, and since I was already in the guts of the compiler I decided to use that momentum to add some new operators. BYOND 512 will now have ?. and ?: operators that are "null-safe"; that is, a?.b will simply be null if a is null. (Actually these operators are more true/false-safe; the real test being done isn't specific to nulls, but I don't care enough about the difference.) These operators can also be used in assignments, like a?.b = 1. A safe version of the list access operator has been requested too, although I'm on the fence about it because it's more complex. One important thing to note about these operators is that they're very efficient, because instead of having to do something like if(client && client.admin) you can simply say if(client?.admin) and the client var is only looked up once. In fact even the first proc call in BiggestMonster()?.KillPlayer() is only done once; you can now accomplish in one line of code what once took two or three.
I looked into the feasibility of adding cascade operators as well, like .. in Dart. That's a darn handy operator, because a..b()..c() is equivalent to a.b() followed by a.c()--except that if a is an expression, it's only evaluated once. I'm quite certain a cascade operator is doable. The problem I have is, that would mean implementing four operators: one that would be the type-insensitive : equivalent, and then null-safe versions of both. I'm not entirely thrilled with adding four new operators for that.
Raw strings are also in, and that was an interesting little project. The new raw strings come in three flavors, and they'll mainly be useful for large blocks of text that you don't want to include escapes in, and little bits of text like regular expressions where escapes are a pain in the butt to deal with. They're supported in .dms files too, but the tricky part is you'd have to have a 512 client to understand them. (One thing I haven't done yet is check on how .dms files are handled at compile time. I believe they're always parsed just to check on their validity, which means I should be able to set a flag requiring 512 clients.)
On the subject of language stuff, I've kind of had an itch for a while now to consider operator overloading. I think it's an idea whose time may have come. Many of the operators already have some level of datum awareness thanks to /matrix. The big trick here, I think, is making sure the path parsing stuff can recognize a keyword like "operator" and expect an operator to follow. But I'm going to let this percolate rather than pull me off course, because lots of other things are waiting in the wings.
But even though I'm spending time in the compiler guts, web work is not forgotten. In fact I had to touch some web stuff because the new raw string feature required an update to the syntax highlighting.
Today and probably a good part of next week I'm going to be doing some digging into 511 bug reports for the next maintenance release; although to be honest, more of that will be early next week because of time constraints, and also some of these are weird enough that they're gonna require me to wrap my head around finding a way to diagnose the problems.
Big thanks to everyone who's contributed to BYOND via Membership or donation this month. Now that April's nearly behind us, summer is about to come in full blast pretty soon. When it's too hot to go outside, it's a perfect time to stay in and play games. And in the meantime, you can still use the excuse of it being too rainy and cold until May gets its ducks in a row.
Apr 28 2017, 9:21 am