• 0 Posts
  • 72 Comments
Joined 3 years ago
cake
Cake day: July 1st, 2023

help-circle



  • The problem of enums in other languages is that they do not make for a distinct type. They are just integers in a name. Or at least that is the case for C and Java enums. Python and JavaScript do not even have enums, which is even worse.

    Strongly typed enums is hardly unique to Rust.

    C++ has had them for a long time, for example: Using a plain integer type where an enum is expected has been prohibited since at least C++98. You can still use an enum in the place of an int, unless you use scoped enums (C++11 or later), which also require an explicit cast to convert from enum to the underlying type.

    And Python has had some form of enum since since 3.4: https://docs.python.org/3/library/enum.html. It’s not a language level feature, but that probably wouldn’t make much of a difference, and it’s as type safe as anything else in the language. But you will get a error when using type-hints, if you pass the wrong type to a function expecting an enum:

    from enum import Enum
    
    class MyEnum(Enum):
        A = 1
        B = 2
    
    def foo(_: MyEnum): ...
    
    foo(1)  # error: Argument 1 to "foo" has incompatible type "int"; expected "MyEnum"  [arg-type]
    








  • It looks like you get what you pay for with SearXNG.

    While SearXNG claims to aggregate results from “more than 70 search services”, the “Engines” tab show that most instances only support a small number of engines, and many of these are degraded. That matches my experience of trying SearXNG, where I entered a few queries on a service that randomly picks an instance: Half of those queries failed due to the instance having been rate-limited by the search providers and the other half gave inconsistent and often poor responses. I’m not sure what engine(s) those instances used.

    I guess I could self-host, and configure and maintain just the engines I want access to, but the time required to do so would very quickly exceed the amount of hours I have to work to pay for a Kagi subscription, so it doesn’t make much sense economically.

    However, one area where I think SearXNG does have a distinct advantage is privacy, provided that you self-host and only use engines that do not require an API key to access. But that’s a tall ask for most people