Introduce a has
operator for bitsets.
#2986
Replies: 3 comments
-
The other problem that has surfaced is that the
|
Beta Was this translation helpful? Give feedback.
-
The official answer to this so far is "No, because it feels weird". Oh well. Keeping the discussion open though |
Beta Was this translation helpful? Give feedback.
-
I also wanted to create a request for introducing the It also makes these two very different loops very easy to confuse Describe the solution you'd like A for loop with a condition: |
Beta Was this translation helpful? Give feedback.
-
Bitsets have
in
operator, which checks whether a specific value is present in a bitset. The enumeration value is written first, and the bitset which you're making a subselection of is written second.This has some issues for language servers and tooling that works with partially-complete AST's. Programmers write their code in a mostly-LTR fashion, so your AST might look something like this:
The text editor has no way of knowing which bitset you're referring to (yet), so it can not display any meaningful hints. An alternative might be to type
if in some_bitset
, then move your cursor backwards and start typing the name of the bitset flag, which is kind of a lot of movements to type something so trivial.This is where the idea comes in. We reverse the order of the bitset and the flags to make it easier for the tooling to have the necessary context for auto-completion without too much friction. Now the situation looks better:
This has one potential downside of introducing a new keyword into the new language. It's not a verb or a noun, so very unlikely to interfere with the existing and new code. Definately not as inconvenient as
package
.Beta Was this translation helpful? Give feedback.
All reactions