Closed L-the-forgettable closed 2 weeks ago
I'd argue this reduces readability by making it harder to tell what the line is doing, making one keyword carry more weight tends to reduce readability IMO
It also makes the compiler and parser more complex, and opening up now areas of error
And it's only a very minor annoyance to have to have one additional line and one level of indentation, so IMO this adds very little and costs much more
and am uncomfortable seeing a large chunk inside my _process(), see image below.
Note that the if event_queue.size() != 0:
is redundant, you can for
over an empty event_queue
just fine (it will result in no iterations). So one indentation level goes away.
and am uncomfortable seeing a large chunk inside my _process(), see image below.
Note that the
if event_queue.size() != 0:
is redundant, you canfor
over an emptyevent_queue
just fine (it will result in no iterations). So one indentation level goes away.
On this specifically, I thought about that afterward and fixed it. Still doesn't make it any less chunky
Regardless, it ultimately isn't too consequential so I'll just put an end to it here.
Describe the project you are working on
I'm currently working on a websocket server for minecraft bedrock clients to connect to. It'll need to process multiple incoming events, from one or more clients, and respond accordingly.
Describe the problem or limitation you are having in your project
I need to make a queue system for the server to process events with, and am uncomfortable seeing a large chunk inside my _process(), see image below.
Describe the feature / enhancement and how it helps to overcome the problem or limitation
The ability to combine "for" and "match" into one line for readability. This could be used in place of the normal for-match usage in cases where all you'll be doing is matching, like in the example above.
Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams
"for event in list match item" could be used instead of "for event in list: \n match item:"
If this enhancement will not be used often, can it be worked around with a few lines of script?
There is no workaround, just use the original way of doing it with all it's chunky glory
Is there a reason why this should be core and not an add-on in the asset library?
I don't think it's possible to do this with an add-on..