39 karma · joined Apr 19, 2017 (9y ago) · 24 submissions
comment 3y ago · link · parent
Second, I'd point out that Sibelius also doesn't allow dragging notes around, and now that I think of it, I haven't seen any GUI notation software that does. Either the developers of all of these apps made the same oversight and haven't realized how obviously critical and non-problematic this feature is, or, maybe the people who responded to you on MuseScore forums explaining that it actually would be a problematic feature are right.
comment 3y ago · link · parent
comment 4y ago · link · parent
comment 4y ago · link · parent
comment 4y ago · link · parent
Of course this doesn't apply to every group of people. As you say, in some circles other non-Apple chat platforms are more popular so this isn't an issue. But don't make the mistake of thinking that just because iMessage isn't popular in your friend circle that it's not popular in general.
comment 5y ago · link · parent
Similarly, idiomatic modern C++ rarely needs new and delete calls, but I'd still say it has manual memory management.
I suppose it's reasonable to talk about degrees of manual-ness, and say that memory management in Rust or modern C++ is less manual than C, but more manual than Go/Python/Java.
comment 5y ago · link · parent
comment 5y ago · link · parent
Edit: It is possible to use constants or variables in a case pattern, but they have to be dotted names to not be treated like a capture pattern. So this would work for your example:
class HttpStatus(Enum):
NOT_FOUND = 404
match status:
case HttpStatus.NOT_FOUND:
return "Not found"comment 6y ago · link · parent
This may be true, but it doesn't contradict the claim that Ada is old-fashioned in this regard. It was an old fashion in programming languages to prefer words over symbols, and to try to make programming languages look more natural language-like to make them more readable. See Ada, Cobol, Pascal or AppleScript for some examples. This is much less common with newer programming languages, where it's much more common to favor terseness and shortcut syntax. It's debatable whether this is better, but it seems undeniable that Ada-style verbosity is no longer in fashion.
comment 8y ago · link · parent
https://docs.python.org/3/reference/datamodel.html#special-l...
Apparently the runtime is even more picky than I showed. The method has to be defined on the object's type, not in the object's instance dictionary. So, really the lookup is something like:
if hasattr(type(a), '__add__'):
The link I provided explains the rationale for bypassing the instance dictionary and `__getattribute__` method.comment 8y ago · link · parent
if '__add__' in a.__dict__:
try:
return a.__add__(b)
except NotImplemented:
if '__radd__' in b.__dict__:
return b.__radd__(a)
elif '__radd__' in b.__dict__:
return b.__radd__(a)
raise TypeError('unsupported operand type(s) for +: '{}' and '{}'.format(type(a), type(b))
In particular, the runtime seems to directly look for '__add__' in the object's __dict__, rather than just trying to invoke `__add__`, so your `__getattribute__` method isn't enough to make it work. If you add an actual `__add__` method to A your example will work.comment 8y ago · link · parent
comment 8y ago · link · parent
comment 9y ago · link · parent
comment 9y ago · link · parent
comment 9y ago · link · parent