• 5 Posts
  • 516 Comments
Joined 5 years ago
cake
Cake day: May 31st, 2020

help-circle
  • Ephera@lemmy.mltoProgrammer Humor@programming.devTariffs
    link
    fedilink
    English
    arrow-up
    2
    ·
    7 days ago

    Oh yeah, I was merely complaining about the syntax. Coming from other languages, I interpreted that import statement to mean essentially this:

    import { double, exponent /*...*/ } as operations from "Math";
    

    …and as such, it took me a few seconds to understand what’s being aliased by as operations.

    As for importing all symbols of a module, I do think it’s more harm than good in non-compiled languages. But when it comes to compiled languages, I’d say it depends on the language.

    In Rust, for example, I can easily throw down an inline module with one-way isolation, so that it can transparently access everything in its parent module via use super::*;, while the parent module can’t access what’s in the module (unless it’s been marked pub). That can reduce mental complexity of the code (and is actually used a lot, because unit tests are typically put into such an inline module).
    It’s also useful in Rust, because you can re-export symbols in different modules, so you can break up a file without breaking the imports by throwing a pub use my_sub_module::*; into the original module.

    But yeah, on the flipside, I really wouldn’t miss it, if it didn’t exist in Java. It was rather even annoying, because the popular IDEs have a rule to replace explicit imports with an asterisk as soon as it reached 5 symbols imported from the same module.
    It’s not as bad as one might think, because you can’t declare top-level functions or variables in Java (everything has to be in a class), but it still sometimes led to those asterisk imports bringing in the wrong class names, so I’d have to manually add the import I wanted underneath them…


  • Ephera@lemmy.mltoProgrammer Humor@programming.devTariffs
    link
    fedilink
    English
    arrow-up
    3
    ·
    8 days ago

    import * as operations from "Math";

    Wow, I knew import syntax with a separate from statement could be awkward, but that’s a new one for me.

    Apparently, the * cannot be used to import all symbols underneath a module (you always have to specify the as moduleName), so I guess, that makes it somewhat less weird for referring to the module itself.

    From what I can tell, there’s also no obvious other keyword they could’ve used:

    • package is only a keyword in strict mode.
    • self is not a keyword.
    • this is kind of awkward.
    • Leaving out the keyword is kind of awkward (import as operations from "Math";).
    • Changing up the whole syntax for this one case is awkward, too (import from "Math" as operations;).

    So, I guess, I’ll allow it, but I’m still not happy about it…


  • Yeah, leaving moral reservations aside, it’s especially annoying to me, because it’s being pushed with complete disregard whether it actually helps me.

    I’ve been working in a programming language for the past two years, in which I’m well-trained. Better than the statistical average that LLMs blurt out, at the very least. So, I’ll often end up correcting whatever it generates, rather than just typing out the same directly. In particular, I also find it much easier to think while typing, rather than while reviewing code, so I need pauses to think anyways. And I also just find it disrupts my concentration when the autocompletion-style LLMs keep flickering their suggestions at me.

    Similarly, flavor images. So much of management is fucking excited about generative AI, because they can type shit like “wombat hanging off of a line of code” and then it slops out an image, which they can slap into their presentation and pretend it has meaning.
    I don’t like those images. The AI-generated ones look terrible to me, but I did not either like them before they were AI-generated. It’s just pointless imagery, why are you showing me this?
    Obviously, management can disagree with my stance, many people do, but if they want me to present shit, they need to respect that my presentation style just does not include flavor images, no matter what flavor image generator we pay for.


  • Ephera@lemmy.mltoMemes@lemmy.mlBig F'N TV
    link
    fedilink
    English
    arrow-up
    11
    ·
    15 days ago

    I mean, yes, but I was rather wondering, if that extra space was maybe why it couldn’t find it. Maybe you had to manually enter the SSID and accidentally put in that extra space? Then again, I don’t even know, if you took that photo…



  • It is, yeah, but you can also use it to host a static webpage: https://codeberg.page/
    Personally, I use it together with mdBook, so I write my texts in Markdown and then get a webpage with search and such. There’s lots of “static site generators” out there which do something similar.

    It’s a little tech-y for what you’re hoping to do, but you could make use of the code tooling for collaboration. People could open issues, if they just want to make a suggestion, or they could create a pull request with a concrete change.






  • Wildly depends on the complexity of the feature. If it only takes 4 hours to implement, you might have good enough of an idea what needs to be done that you can estimate it with 1-hour-precision. That is, if you’re only doing things that you’ve done in a similar form before.

    If the feature takes two weeks to implement, there’s so many steps involved in accomplishing that, that there’s a high chance for one of the steps to explode in complexity. Then you might be working on it for six weeks.

    But yeah, I also double any estimate that I’m feeling, because reality shows that that ends up being more accurate, since I likely won’t have all complexity in mind, so in some sense my baseline assumed error is already 100%.


  • Well, I think your idea would be simpler, if we weren’t talking about Java.
    Pretty much everything is an object in Java. It’s only logical that a type would also be an object and have associated fields.

    Similarly, what you’re thinking of as “reference types directly” doesn’t make sense in Java, because it lacks many of the systems to make that actually usable like a type. What you get from .class is a Class object, which you can’t stick into a generic type parameter, for example.
    It basically uses reflection to give you e.g. the name of that type and you can also instantiate an object of that type, if no parameters need to be passed to the constructor function.

    And then, yeah, I think for explaining that you merely get an object which roughly describes the type, the separate .class field is a good idea.


  • Well, it also avoids running instantiation code, which could be doing all kinds of things. In theory, it could have a side-effect which modifies some of your application state or issues a log statement or whatever.

    Even if it doesn’t do anything wild right now, someone could change that in the future, so avoiding running such code when it’s not needed is generally a good idea.


  • Ephera@lemmy.mltoProgrammer Humor@programming.devCode analyzer lore
    link
    fedilink
    English
    arrow-up
    15
    arrow-down
    1
    ·
    25 days ago

    I don’t believe there is much deeper of an explanation than “because the Java designers didn’t implement support for that”.

    That feature is called “types as a first-class value” and you need to implement some special casing or an entire system in the language to make it work. Telling devs there’s a special static variable .class is conceptually simpler to implement and understand.


  • Well, the thing is, if you’re developing a library, you usually do so, because you want it to be useful to people in the ecosystem.
    By putting it under the GPL, you limit that usefulness to only those projects which are willing to also put themselves under the GPL. From an idealist point of view, I certainly also would like to say that people not willing to put their software under GPL don’t need to be my users. But from a library author point of view, I might as well not write a library then, since no one’s going to use it then.

    Many open-source projects are under a permissive license themselves. I might disagree with their choice, but I don’t really want to exclude those from using my library. They’re still doing good things. I would love to exclude specifically any proprietary software from using my library, but that’s not really something you can require in your license without excluding all those permissive open-source projects.

    So, to answer your question, I actually don’t think people are being tricked into it. I thought about choosing GPL for my libraries for a while (all my applications are under GPL) and decided against it. Which is a personal choice that others can disagree with, but all I’m saying is, I know what I’m doing, I wasn’t tricked to use a permissive license.


  • Ephera@lemmy.mltoMemes@lemmy.mlDiversity in your ear holes
    link
    fedilink
    English
    arrow-up
    6
    ·
    26 days ago

    Yeah, I just put my whole collection on shuffle and have come to appreciate the simplicity of that.

    I use this web music player at home, which only supports shuffle and because it’s a web thing, I can’t either use keyboard shortcuts to skip songs (without switching to that window).
    And I actually like that I can’t distract myself with selecting just the right music. Because if I don’t distract myself and just get into coding or whatever, I’ll quickly stop noticing what precise music is playing.