• 0 Posts
  • 117 Comments
Joined 1 year ago
cake
Cake day: June 21st, 2023

help-circle
  • Pushing HTML even further, one could say it’s a declarative programming language that programs a UI in a mostly-stateless manner (inputs aren’t really stateless but you can argue the state is provided by the UI rather than managed by HTML).

    I’m not sure I’d make this leap myself though, I have a hard time classifying it (or any other markup language) as a PL. As far as I am aware, you can’t really program a state machine with pure HTML, though you can accept inputs and return outputs at least.



  • I think it’s good to document why things are done, but extracting things out into another function is just documenting what is being done with extra steps. This also comes with a number of problems:

    1. Not all languages are readable. Documenting what is being done is important in some C, or when working with some libraries that have confusing usage syntax.
    2. Not all people reading the code know the language or libraries well. Those people need guidance to understand what the code is trying to do. Function names can of course do this, but…
    3. Not all types can be named in all languages. Some languages have a concept of “opaque types”, which explicitly have no name. If parameter and return types must be specified in that language, working around that restriction may result in unnecessarily complicated code.
    4. Longer files (the result of having dozens of single-use functions) are less readable. Related logic is now detached into pointers that go all over the file all because of an allergic reaction to code comments, where a simple // or # would have made the code just as readable.
    5. Function names can be just as outdated as code comments. Both require upkeep. Speaking from personal experience, I’ve seen some truly misleading/incorrect function names.




  • For library code - yes, you’d usually want to direct users to the correct way of using the library, so you’d be more likely to come across fallible build functions or a bunch of type parameters to constrain when it can be called.

    For applications - honestly, it’s your code, so do what makes sense to you. Using a build function can help you ensure your settings were fully configured before using them, but it’s up to you if that’s the direction that makes the most sense to you. One benefit is you only need to perform the check once, but the downside is having another “built” type that you need to keep in sync with the original type. You can also look at libraries like derive_builder if you want to have your builder generated for you to avoid needing to manually update two separate types.






  • The hourly wage here seems below 1 dollar.

    I’m surprised this is even legal. I mean, of course it’s fine to scam a bunch of desperate people looking to pad their resumes. Why wouldn’t it be?

    Unless you have no other source of income, then I don’t see these making sense. Even then, consider if retail or food industry might be a better use of your time until you can find something better (unironically - they can be great experiences).




  • This advice mostly applies to people who are less experienced and less familiar with just how complex HTML can be. As for other languages - if you’re doing regex on markdown, you’ll probably be fine (but you should verify if you’re writing something for the general case that must not fail). But in HTML’s case:

    • You have nested languages (CSS and JS)
    • You have tag-specific rules (img and link end in />, but div must end in a separate closing tag)
    • Browsers use error correction to try to make sense of invalid HTML, like inserting missing tags. Many websites rely on this behavior.

    If you’re trying to use Regex to parse a specific website’s HTML, you’ll be able to get what you want eventually, but as a general HTML parser, there will always be some website that breaks your assumptions.


  • If you’re writing C#, you could take a look into Source Generators. They’re supported directly by Roslyn I believe, and are pure C# instead of t4’s syntax. They’re often used with attributes to augment types, but I believe they can be used to generate sources on their own, and even read from a config file if you want to (or maybe even query the DB, if that’s something you want to do at build time for some reason, though I’ve never tried this).





  • If you’re looking to contribute to the standardization process for web standards and propose a new idea, you could try looking into discussion channels for W3C. From my understanding, they are the ones who maintain the ActivityPub/ActivityStreams standards, though I’ll admit I don’t know much about the process. IETF also seems to be responsible for the WebDAV RFC. You could try reaching out to them to see if they still have interest in it or a place to discuss it.

    Otherwise, I don’t know of any communities specific to that topic, but you could always build your own extension to WebDAV anyway. Things are created when people build them, so be the one to do it and popularize it!