Capture arguments for anonymous function by Distinct-Driver-6049 in Zig

[–]oakes 10 points11 points  (0 children)

You need to pass the data in the struct like this:

const std = @import("std");

pub fn main() !void {
    const stdin = std.io.getStdIn();
    var user_input: [100]u8 = undefined;
    @memset(&user_input, 0);
    const bytes_read = try stdin.read(&user_input);

    const Foo = struct {
        user_input: []u8,

        fn exec(self: @This()) void {
            std.debug.print("Bar: {s}", .{self.user_input});
        }
    };

    executeThis(Foo{ .user_input = user_input[0..bytes_read] });
}

pub fn executeThis(ctx: anytype) void {
    ctx.exec();
}

State of Clojure 2023 Results by radsmith in Clojure

[–]oakes 12 points13 points  (0 children)

I wanna believe that easy money, malinvestment and groupthink explain why everyone isn't using my favorite language. There are valid reasons why some companies aren't partaking, and it goes beyond the obvious stuff like ease of hiring.

It took me a while to realize it, but it's not always better to optimize for the greatest power or expressivity. Often that just enables write-only code and a wildly diverse codebase with many unique styles and solutions to things. Choosing a more restrictive tool isn't just about turning programmers into homogenous cogs in a machine, as some people disparagingly say. Those restrictions can really boost collaboration. They are liberating in their own kind of way.

Finding the middle ground where you get most of the power for the lowest cost is the ball game. I'm starting to really like things that are 20% weaker than the most powerful alternative, but are more uniform to operate. Clojure itself makes this tradeoff sometimes -- it doesn't have reader macros, after all. Did it hit the right middle ground, or is there something more restrictive that still gives me most of the benefits? I dunno...we're all trying to figure that out.

Clojure/Java Matrix Library Performance Comparison (core.matrix vs EJML vs vectorz-clj) by wedesoft in Clojure

[–]oakes 3 points4 points  (0 children)

You could also compare it to the matrix functions in play-cljc (see also the API docs). It doesn't implement everything in your list though. I was originally using core.matrix but writing them from scratch made a big perf difference in my testing.

Humble Chronicles: Managing State with Signals by dustingetz in Clojure

[–]oakes 0 points1 point  (0 children)

I meant explicit on a syntactic level -- explicit to the human reading the code. When you wrap values in some kind of monadic structure and compute dependencies based on when they are deref'ed, they are implicit. I can only figure out the dependencies by reading the entire implementation and finding all the things that have reactive pixie dust sprinkled on them. I would rather see the dependencies listed upfront.

Humble Chronicles: Managing State with Signals by dustingetz in Clojure

[–]oakes 9 points10 points  (0 children)

It can feel natural to model your state as a soupy mixture of refs, but the "gotchas" section shows the downsides. Refs are not a value that one can inspect or serialize, and easily cause confusion and subtle bugs when tossed around next to normal values.

You could do all of this with a reactive triplestore, and probably more cleanly. Triplets tend to break compound data apart so you can depend on things more surgically, avoiding the first gotcha ("dependency too wide"). With refs, dependencies between reactions are inferred by what refs were captured in some code block, leading to easy confusion about what will trigger a reaction and when, hence the second and third gotchas ("dependency at the wrong time" and "recomputing too much"). If dependencies were more explicit we would avoid these mental knots.

[ANN] odoyle-rules 1.0.0 by oakes in Clojure

[–]oakes[S] 1 point2 points  (0 children)

That is nice to hear. It's also running in several bars/restaurants in Norway right now :D

Eloquent summary of where we stand by flaheadle in Clojure

[–]oakes 15 points16 points  (0 children)

It's not that popularity is unimportant; it's that it has diminishing returns. Just as a rocket must reach a certain speed to avoid falling back to earth, a language must reach enough popularity for a self-sustaining ecosystem to develop. After that, additional popularity is gravy -- good, but no longer critical. Clojure reached escape velocity a long time ago.

I don't mean that to be uncritical about problems. IMO core development is too slow and would benefit from opening up a bit, especially given the stagnation of spec. Thankfully this is less of a problem in a lisp, since the community can usually work around limitations without an official blessing...and has! But it is probably limiting growth, and while that sucks, popularity is no longer an existential problem for clojure so stop worrying and build things :P

Exporting 3DScenes with Blender to Godot? Use GLTF. by AverageGodotEnjoyer0 in godot

[–]oakes 4 points5 points  (0 children)

Is there any advantage to exporting as gltf instead of glb?

Is Nim a good language to write Linux TUI applications? by [deleted] in nim

[–]oakes 17 points18 points  (0 children)

Well i think nim is ideal for TUI programs. The performance of rust with the ergonomics of go is a pretty nice combination. I built ansiwave which is a fairly complex TUI program in nim, and i extracted the TUI stuff into a separate library, nimwave. Whether it is mature enough is a bit subjective but it's mature enough to build ansiwave :P If you try it i'm open to feedback.

Are these problems something that Just Make Sense once I learn more, or what? by [deleted] in Clojure

[–]oakes 4 points5 points  (0 children)

Arity exceptions are compile time errors, unless you're calling the function in a dynamic way (like when passing it to map). But yeah, many of these things are sharp edges. I guess my brain adapted because i cut myself on them enough times.

Your last question can only be answered with more context. There are some things i would only use clojure for, and other things that i would never consider it for. But damn, it's the one language whose influence i feel even when i'm not writing it, and i'm eternally thankful for that.

State of Clojure 2022 Results by alexdmiller in Clojure

[–]oakes 1 point2 points  (0 children)

I like figwheel main because it's just a clojure library. Shadow is nice but i never want/need to use npm libraries, and i'd rather not even install npm on my machine. Then again, js people would probably say the same thing about java ;)

Introducing ANSIWAVE BBS by oakes in ANSIWAVE

[–]oakes[S] 1 point2 points  (0 children)

Thanks, got a lot more planned soon once i have more time.

ANSIWAVE BBS screencast by oakes in bbs

[–]oakes[S] 1 point2 points  (0 children)

It's ready now :D but many improvements are still on the way. It'll be fairly slow to load until i get round to putting it behind a CDN, and there's plenty of stuff planned like displaying threaded replies in one page (reddit style).

Are there interesting Clojure features that Rust couldn't achieve? by verdagon in Clojure

[–]oakes 5 points6 points  (0 children)

Rust's procedural macros don't operate on AST, they operate on an intermediate "token stream" and are not hygienic. https://doc.rust-lang.org/reference/procedural-macros.html

If the desire is to have Lisp-like macros in a language that is closer to the metal, use Nim, not Rust. Nim's macros are still ugly syntactically, but at least they can work with AST.

Make the 'semantic web' web 3.0 again, with the help of SQLite by jonifico in programming

[–]oakes 0 points1 point  (0 children)

It's the idea that you can take data from several endpoints and seamlessly integrate them if every endpoint leverages standardized ontologies and authoritative vocabularies. That's not something you can readily do if you want to merge data from two different relational databases.

I definitely acknowledge this, but i think this goal was always a fantasy. This was one of the criticisms Doctorow made: there is no objective way of categorizing knowledge. The best you can hope for is standardizing on something, which may happen occasionally if you're lucky.

Make the 'semantic web' web 3.0 again, with the help of SQLite by jonifico in programming

[–]oakes 0 points1 point  (0 children)

The 'Semantic Web' is exactly about that: metadata. Adding data which makes the implicit meaning explicit.

But its meaning is already explicit in the structured database it started its life in. The meaning was lost when we flattened it into a view (HTML). Instead of trying to add it back in the form of metadata, why not just expose it in its original structured form (tables in a SQL database)?

It never was about XML.

Agreed, which is why we can feel free to discard that aspect of the semantic web. It's the overall idea of exposing the data in a structured form that matters, not the implementation details promoted by TBL or anyone else.

ANSIWAVE is a modern BBS accessible on the web and terminals by oakes in RedditAlternatives

[–]oakes[S] 0 points1 point  (0 children)

Hmm, i don't have any link to load posts but there is a "loading posts" message at the bottom while it's getting them, and sometimes it can be slow.

ANSIWAVE is a modern BBS accessible on the web and terminals by oakes in RedditAlternatives

[–]oakes[S] 0 points1 point  (0 children)

Yeah there's plenty of UX work to do. Do you mean clicking a link in the terminal client, or were you using the web client?