Programming

26072 readers
137 users here now

Welcome to the main community in programming.dev! Feel free to post anything relating to programming here!

Cross posting is strongly encouraged in the instance. If you feel your post or another person's post makes sense in another community cross post into it.

Hope you enjoy the instance!

Rules

Rules

  • Follow the programming.dev instance rules
  • Keep content related to programming in some way
  • If you're posting long videos try to add in some form of tldr for those who don't want to watch videos

Wormhole

Follow the wormhole through a path of communities !webdev@programming.dev



founded 2 years ago
MODERATORS
26
27
28
 
 

What kind of code microprofiling/benchmarking software do you guys use? I was wondering if anyone knew of any that can also be used as a separate tool (open source preferred but I dont mind proprietary) rather than already integrated into something like Visual Studio.

Edit: I would like it to support Windows and Linux. I mostly program in C right now, but expanding into other languages (e.g., Rust, Python)

29
30
 
 

Why aren't people moving away from Github? There's Codeberg, Gitlab, and radicle. What's holding them back?

31
32
47
Sad about .NET (thelemmy.club)
submitted 1 week ago* (last edited 1 week ago) by edm@thelemmy.club to c/programming@programming.dev
 
 

These last ten years I was really enjoying what Microsoft and its .NET teams were doing. Felt like a good community to be a part of. Huge strides to make things run anywhere and be more involved with the open source community.

While that hasn't necessarily gone away, jamming LLM's into everything is leaving a real sour taste. Pointless copilot button anywhere and everywhere. VS and VSCode pushing the GitHub copilot chats and agents.

We are quickly back to the corporate MSFT that doesn't listen to its users or employees. All that good will has been washed away and now I feel the need to switch off of Windows.

33
 
 

In the previous post, JADEx introduced a new feature ~~Immutability~~.
Through community feedback, several confusions and limitations were identified.

In v0.42, we have addressed these issues and improved the feature. This post explains the key improvements and new additions in this release.


Improvements

~~apply immutability~~ -> apply readonly

  • The previous term (Immutability) caused misunderstandings.
  • Community feedback revealed that “Immutable” was interpreted differently by different developers, either as Deeply Immutable or Shallowly Immutable.
  • In v0.42, we replaced it with readonly.
  • Meaning: clearly indicates final by default, preventing reassignment of variables.

Expanded Scope of final keyword: now includes method parameters

  • v0.41: final was applied only to fields + local variables
  • v0.42: final is applied to fields + local variables + method parameters
  • Method parameters are now readonly by default, preventing accidental reassignment inside methods.

Example Code

JADEx Source Code

package jadex.example;

apply readonly;

public class Readonly {

    private int capacity = 2; // readonly
    private String? msg = "readonly"; // readonly

    private int uninitializedCapacity; // error (uninitialized readonly)
    private String uninitializedMsg;    // error (uninitialized readonly)

    private mutable String? mutableMsg = "mutable";  // mutable

    public static void printMessages(String? mutableParam, String? readonlyParam) {

        mutableParam = "try to change"; // error
        readonlyParam = "try to change"; // error

        System.out.println("mutableParam: " + mutableParam);
        System.out.println("readonlyParam: " + readonlyParam);
    }

    public static void main(String[] args) {
        var readonly = new Readonly();
        String? mutableMsg = "changed mutable";

        readonly.capacity = 10; // error
        readonly.msg = "new readonly"; // error

        readonly.mutableMsg = mutableMsg;

        printMessages(readonly.msg, mutableMsg);

        System.out.println("mutableMsg: " + readonly.mutableMsg);
        System.out.println("capacity: " + readonly.capacity);
        System.out.println("msg: " + readonly.msg);
    }
}

Generated Java Code

package jadex.example;

import org.jspecify.annotations.NullMarked;
import org.jspecify.annotations.Nullable;
import jadex.runtime.SafeAccess;

//apply readonly;

@NullMarked
public class Readonly {

    private final int capacity = 2; // readonly
    private final @Nullable String msg = "readonly"; // readonly

    private final int uninitializedCapacity; // error (uninitilaized readonly)
    private final String uninitializedMsg; // error (uninitilaized readonly)

    private @Nullable String mutableMsg = "mutable";  // mutable

    public static void printMessages(final @Nullable String mutableParam, final @Nullable String readonlyParam) {

        mutableParam = "try to change"; //error
        readonlyParam = "try to change"; //error

        System.out.println("mutableParam: " + mutableParam);
        System.out.println("readonlyParam: " + readonlyParam);
    }

    public static void main(final String[] args) {
        final var readonly = new Readonly();
        final @Nullable String mutableMsg = "changed mutable";

        readonly.capacity = 10; //error
        readonly.msg = "new readonly"; //error

        readonly.mutableMsg = mutableMsg;

        printMessages(readonly.msg, mutableMsg);

        System.out.println("mutableMsg: " + readonly.mutableMsg);
        System.out.println("capacity: " + readonly.capacity);
        System.out.println("msg: " + readonly.msg);
    }
}

New Additions

JSpecify @NullMarked Annotation Support

  • All Java code generated by JADEx now includes the @NullMarked annotation.
  • This improves Null-Safety along with readonly enforcement.

This feature is available starting from JADEx v0.42. Since the IntelliJ Plugin for JADEx v0.42 has not yet been published on the JetBrains Marketplace, if you wish to try it, please download the JADEx IntelliJ Plugin from the link below and install it manually.

JADEx v0.42 IntelliJ Plugin

We highly welcome your feedback on JADEx.

Thank you.

34
 
 

API-wise, native apps lost to web apps a long time ago. Native APIs are terrible to use, and OS vendors use everything in their power to make you not want to develop native apps for their platform.

35
36
37
 
 

Following in the footsteps of Hashicorp, Hudson, etc. Zed has chosen to cash in the good will of its now substantial user base and start going to full corporate enshittification. Among other things like minimum age nonsense, they have also added binding mandatory opt-OUT arbitration.

I find such agreements very troubling, because it gives up public funded dispute resolution for private which nearly unanimously benefits larger entities, it lowers transparency to near zero, and eliminates the abilities to act as a class and to appeal. But I worry most will just accept it, as is the norm.

You can however opt out by emailing arbitration-opt-out@zed.dev with full legal name, the email address associated with your account, and a statement that you want to opt out.

I'll just consider my days of advocating for Zed as an interesting new editor over and go back to Neovim bliss.

38
39
 
 

Very recently a brand new account commented on my posts with that looked a lot like pictures of my house. The account is @WellWellWaldo@programming.dev, they deleted their account but not the media uploaded.

40
41
 
 

I am using rust, but this applies to many other languages, I get warnings like, dead code, unused variables, and etc, and while I remove most of them, there are some im not sure of, I like running my program and there being 0 warnings, or 0 warnings as i scroll down my code, so for things im unsure of, i mark them so the compiler doesn't put warnings there. I also add comments, starting with TODO:, it has some information about what to think about when i revisit it, also the todo's gets highlighed in my IDE with my extension, but is this bad practice?

42
43
 
 

I'm trying to find a place where you can ask broader development questions, not just specific error messages.

StackOverflow and Codidact are way too restrictive, if your question isn't a precise technical issue with a reproducible example, it gets shut down immediately. Reddit and Lemmy seem more focused on news and memes; actual questions and discussions tend to just sink without engagement. And honestly, the kind of specific error-driven questions StackOverflow excels at are things AI can solve instantly now.

What I'm really looking for is a community (forum, Discord, whatever) where you can get help on broader topics related to software engineering.

Does anything like this still exist? Somewhere with actual humans willing to discuss the process of building software, not just fix syntax?

44
 
 

I teach computer science at Montana State University. I am the father of three sons who all know I am a computer programmer and one of whom, at least, has expressed interest in the field. I love computer programming and try to communicate that love to my sons, the students in my classes and anyone else who will listen.

A question I am increasingly getting from relatives, friends and students is:

Given AI, should I still consider becoming a computer programmer?

My response to this is: “Yes, and…”

45
46
47
 
 

I am trying to write my own string.h functions, my library currently have no dependicies and 11 functions completed. Has basic and readable code to understand. Small binary size. Freely distributable with BSD-3-Clause license. Have a look: mstrutils

48
 
 

How it all started?

Sometimes, there are moments in life then you feel loosing control over your life, when there is to much on a plate and all this overwhelms you, makes you anxious. For me, solution always was to use kind of "get things done" tools, to organize myself. I tried enormous amount of todo apps, even bought a paper todo, but this wasn't enough this time. Every restriction in functionality, every missed feature made me feel I'm loosing control again. And one moment I gave up and decided it is time to make my own tool and make it right (in my understanding), i.e . a todo that is highly customazible and instead of hardcoded features can have any you want. Despite todo app is an anecdote and there are thousands of them, same as with an edit tool microsoft it is quite a challenging task to make a really good one.

Design/Concept

Luckily, I had 2 weeks of winter holidays and I decided to invest this time into this project. I thought a lot on how to make a todo that potentially have any possible feature that anyone can simply add just when they need it. My solution was a Virtual Machine with persistent storage + Tasks that have their own executable instructions. So in this design any todo app could be a simple wrapper around i/o and all functionality would be powered by the virtual machine.

Problems/Complexity

Creation of a working vm is a complex task for sure. I will not mention every problem I had faced during last months, but will just list some features I implemented to solve them:

  • NaN-boxing — All stack values are 64-bit (u64) encoding 6 distinct types (Null, Boolean(TRUE_VAL,FALSE_VAL), STRING_VAL, CALLDATA_VAL, U32_VAL, MEM_SLICE_VAL (offset: 25 bits, size: 25 bits)).
  • InlineVec — Fixed-size array-backed vector implementation used for stack, control stack, call stack, and jump stack with specified limits.
  • Dynamic Memory/Heap — growable Vec heap; memory slices use 25-bit offset and 25-bit size fields (limited by MEM_SLICE_VAL).
  • Definite Loops — DO…LOOP with control stack limit =2 ie 2 nested loops only possible for now.
  • Conditional jump - IF..THEN with jump stack limit =2 ie 2 nested IF..THEN statements only possible for now.
  • Custom binary encoding/decoding implementation.
  • Also vm has zero dependencies.

Current state

My Virtual Machine is still in it's early days and may be missing some important instructions, but already now it can be used for a todo app demo with programmable tasks. All operations — from simple CRUD to the tasks' own instructions — are executed by the virtual machine. The concept in a nutshell is, that any kind of automation or workflow can be enabled by task instructions executed by the VM, rather than hardcoded functions in the app - exactly what I wanted to achieve initially! There are 4 demo task instructions that are not a part of the todo code, but instead are in toml file which could be updated any time with a new one:

  • chain - Creates next task once when another is completed. Removes calldata after call - called once
  • either - Sets complete if either one or another task is completed + deletes not completed task (see gif)
  • destructable - task self destructs when it’s status set to complete
  • hide - Keeps task hidden while specified task’s status is not complete.

Example link: https://github.com/tracyspacy/spacydo/tree/main/examples/todo

When I added the todo example, I realized, that the originally hardcoded states in the VM were a limitation. If I would make them generic (which I did), the Virtual Machine would serve more than just todo apps: new use cases such as tasks orchestration and even state machines became possible. I added a finite state machine primitive example as well - a traffic light - where task is a simple state machine which has own state transition rules in calldata that executes each task's instructions call.

Example link: https://github.com/tracyspacy/spacydo/tree/main/examples/traffic_light

I'm still working on this project alone and struggle to get other people involved to help me stabilize and finalize the VM.

Anyway, this journey is interesting and insightful, and I'm curious what comes next.

49
50
 
 

Sample with fibonacci:

⍥◡+9∩1 is the fibonacci in this language

view more: ‹ prev next ›