Trying to learn and exploring by porting over some code from VNDB.

Ecto looks nice, but fetching nested data structures only seems to be supported through `:preload` with a predefined Schema. I wonder if It's possible to generalize that to work without a schema. Or perhaps it makes more sense to port my `enrich_list` function.

Here's a side-by-side comparison of Perl and Elixir doing the same thing. I'm obviously not well versed in Elixir yet.

"93% of Paint Splatters are Valid Programs"

This is genius.
colinm.org/sigbovik/

I thought I had finally devised a good method to dynamically construct SQL queries in , but it turns out I can make a horrible mess of everything.

I hadn't touched for a month, but I hadn't lost my touch! My first line after coming back to a Perl project is this gem:

($e->{name}, $e->{original}) = @{(grep $_->{aid} == $e->{aid}, @{$e->{alias}})[0]}{'name', 'original'};

(It's really nothing special, it just looks so... noisy. It's art! 😆)

It's funny how my opinion on strong vs. weak typing changes almost every year. On the one hand, I've yet to find a statically typed language where I am even *close* as productive as I am in . On the other hand, I keep making stupid silly mistakes that would have been easily caught with a static type system.

Where's that holy grail of hyperproductivity AND safety?

Functional programming in is awkward, why do I keep trying?

After all these years, I'm still not sure how to generate HTML with .

I spent a lot of effort to make embedding HTML inside Perl non-ugly, but the result still isn't something I'm proud of: code.blicky.net/yorhel/vndb/sr

But it is certainly better than the Perl-inside-HTML templating mess that I used 10 years ago: code.blicky.net/yorhel/vndb/sr

There's gotta be a more elegant way.

I did a poll on about possible ways to help motivate people to contribute to the codebase. The results are pretty interesting. vndb.org/t10746?pollview=1

What surprises me is that there aren't even that many votes for the "get rid of Perl" option, despite often being cited as the most hated programming language.

Aw damn. I was hoping to automatically extract form validation regexes from my code to use as HTML5 validation patterns, so I wouldn't have to repeat them. But Perl (understandably) adds the compilation flags to the stringified regex, and the syntax and supported flags aren't quite universal among engines. :oh_no:

I absolutely love it when something that sounds complex ends up being pretty simple.

Yesterday I wrote a script to make a selective export of the database for development purposes (vndb.org/d8#3). The database scheme is pretty large and complex, with 69 tables, 369 columns and 95 foreign key constraints. But with a little ingenuity the script ended up being a pretty elegant 200 lines: code.blicky.net/yorhel/vndb/sr

(Many thanks to ' COPY and DEFERRABLE constraints 👌 )

I just realized my new data validation module could solve all my issues with <-> data interchange. The validation schema can be used to derive Elm data types and generate code to do JSON encoding and decoding. The same schema can be used to coerce Perl data into the appropriate format for the JSON decoder.

I wonder if I should continue with this approach. It trades complexity for some DRY. And nobody uses Perl nowadays, so I'll be the only user of the necessary tooling. :blobunsure:

and are a pretty good match for most scenarios, but when the other side is picky about booleans being booleans and numbers being numbers, things tend to get messy.

This has happened to me several times now: I'm looking for reference documentation on a feature I've been using for a while, to verify that what I'm doing is sensible and portable. Instead of finding what I was looking for, I find that there are other cool new features that I wasn't aware of.

In this case, I was looking for 'sub PackageName::myfunc { .. }' syntax, and instead I learned that Perl has support for lexically scoped subroutines since 5.18. I'll be using that!

I have now written the most perfect data validation module for . It's concise yet powerful, an absolute masterpiece.

...almost. The only thing it needs is 20 pages of documentation, which I'm totally not in the mood to write. 😭

Whenever I code in , I wish it was more functional. Whenever I code in , I wish it was more dynamic. Maybe I ought to give or a try at some point.

Let's do this
/ thing after all, since the profile description doesn't give me much room.

I write code, mostly backend and :tux: tooling. Mainly and , but also have a few projects in and .

I do :gentoo: sysadmin and host sites:
vndb.org/
manned.org/
zerochan.net/
and a bunch more.

I read: goodreads.com/review/list/7129
I watch anime: anidb.net/up36778
I sometimes play visual novels: vndb.org/u2

Writing tests is never very exciting, but at least is concise.

Playing around with some ideas for (yet another) data validation module in . p.blicky.net/KwWzQFHx1ivT

niu.moe

Welcome to your niu world ! We are a cute and loving international community O(≧▽≦)O !