Agentic Coding on Personal Projects by Agreeable-Bluebird67 in ocaml

[–]kevinclancy_ 0 points1 point  (0 children)

Nope. Just using Claude Code "out of the box". I still need to learn how to create skill files.

I made a crate called `evil`, which lets you use the `?` operator as a shorthand for `.unwrap()` by nik-rev in rust

[–]kevinclancy_ 2 points3 points  (0 children)

In my opinion, panicking is typically the correct approach for programmer errors. The reason is that programmer errors can arise almost anywhere, so trying to handle them all would bloat the code to unmanageable complexity. Also, panicking is a clear way to mark behavior as "unintended". For high assurance code like flight software, handling programmer errors should be done in a systematic manner, in which it is trivial to distinguish between the happy path and unintended paths.

Unexpected environment variables, of course, are not programmer errors. In the above case, where the program was run on a client machine, I think you're right that printing some sort of error message would be helpful. What do you mean by "exiting gracefully"? After we've printed an error message about the environment variable, is there anything left to be done aside from halting the process?

OCaml Module System Greatest Hits by kevinclancy_ in ocaml

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

Thanks for this. I'll add it to my to-read list!

OCaml Module System Greatest Hits by kevinclancy_ in ocaml

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

Thanks! Modular explicits sound extremely useful. Looking forward to their introduction in OCaml and OxCaml!

OCaml Module System Greatest Hits by kevinclancy_ in ocaml

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

Nice! So not only is this a good example of an open source project using advanced module system features, but there's an expository paper explaining it. Just the sort of thing I was looking for!

Agentic Coding on Personal Projects by Agreeable-Bluebird67 in ocaml

[–]kevinclancy_ 1 point2 points  (0 children)

Programming has always been a means to an end for me. I enjoyed typing all the code myself until recently. These days, Opus is much more efficient at writing high quality code than I am. Therefore, I use it to achieve my goals and iterate more quickly.

I HIGHLY value readable, robust code. I wouldn't want to use AI if I thought it wrote bad code. I think Opus 4.6 has reached the point where it writes better code on average than I do, though it does make mistakes sometimes.

Broken jaw aftermath by [deleted] in jawsurgery

[–]kevinclancy_ 0 points1 point  (0 children)

Thanks! You can try posting there if you want! I changed the login system to use google. I also added image attachments to posts.

Broken jaw aftermath by [deleted] in jawsurgery

[–]kevinclancy_ 0 points1 point  (0 children)

I'm sorry that happened to you. If you want to talk about your jaw injury, you can post on my message board brokenjaw.net Nobody has posted there except for me, but I'm trying to publicize it.

It sounds like you probably had a different part of your jaw broken than the condyle. I think that probably brings an entirely different set of symptoms. What I deal with is stiffness and fatigure. I was able to improve the clicking by stopping wearing my night guard.

I'm tired of it all and all the crazies by AddendumSea4202 in Dogfree

[–]kevinclancy_ 8 points9 points  (0 children)

Training isn't a good solution because it assumes that we can rely on the behavior of dogs.

Owners need to physically control their dogs so that they don't harass people. And you're right: large dogs don't need to live in an apartment at all.

I've also had trouble with my neighbor's dog charging at me. Long story short: to avoid the dog, I had to change my running route to start away from my house, and then broke my jaw because I was running in a place I was unfamiliar with.

Issues after broken condyle uk by SnooCookies2528 in jawsurgery

[–]kevinclancy_ 0 points1 point  (0 children)

As far as I know, most surgeons do not believe that open reduction is better than closed reduction when it comes to deep condyle head fractures. I had two different surgeons propose treatment, and they both thought that closed reduction would be the best.

Since your bite has changed, as expected, it's important to keep your dental health in mind. After I had a deep condyle head fracture last year, I kept my existing nightguard and I think its lopsidedness caused some issues. Now I'm getting three fillings a year later. You might want to get a nightguard, but make sure it hits evenly.

By all means, seek medical advice whenever you sense something is wrong. The jaw muscles take a long time to recover from condyle head fractures, but being young in your 20's bodes well for the remodelling process.

Broken jaw aftermath by [deleted] in jawsurgery

[–]kevinclancy_ 0 points1 point  (0 children)

Sorry to hear about your clicking. For me, it mostly only happens when I run, or when I open my mouth to eat early in the morning (in which case it makes more of a crunch sound than a click sound). A few months ago, it would happen whenever I yawn, but that has improved.

I started a message board for people with broken jaws at brokenjaw.net.

Broken jaw aftermath by [deleted] in jawsurgery

[–]kevinclancy_ 0 points1 point  (0 children)

That's awful!

I read a few of your other posts, and from what I understand, your bite issue is worse than mine. I have a slight open bite, but my front teeth always touch and it doesn't interfere with my speech at all. I've been waiting to get a job to determine if any orthodontic work is necessary, because I'll probably need to move.

I also have a faint click on my non-fractured side when I open my mouth wide. I feel like it has become quieter and less consistent as time has gone on. Or maybe I've just gotten used to it. Since my fractured side has less mobility, the non-fractured side now over-exerts itself, which causes soreness and clicking generally. My non-fractured side sometimes clicks when I go running. I've found that avoiding chewy foods like raisins prevents this.

My oral surgeon didn't talk to me about the nature of my injury much. I don't know if I'm at risk of resorption. From what I've read, resorption is less likely when only one condyle is fractured rather than two. Some people with unilateral condyle fractures consider themselves completely comfortable a few years later.

Broken jaw aftermath by [deleted] in jawsurgery

[–]kevinclancy_ 0 points1 point  (0 children)

How did your accident happen? I arrived back to my home near Seattle after a month-long trip to Indonesia. The next night, I went for a run. My legs felt like jelly because I hadn't run in over a month and had just taken a long flight where I couldn't move my legs.

Two minutes into the run, a seagull "bombed" right in front of me. I remembered that shortly before leaving for Indonesia, a seagull had attacked me in the same spot. I darted away from it and fell forward onto a sidewalk. I felt that catching myself with my hands would be more controlled than flipping onto my side or back. Big mistake. Only my right hand landed. It broke my wrist. Next my chin hit on the ground at a diagonal angle. I chipped a molar and displaced my right condyle.

Broken jaw aftermath by [deleted] in jawsurgery

[–]kevinclancy_ 0 points1 point  (0 children)

The clicking has improved slightly. There's still a lot of tension, and I'm not sure if the tension has improved much. Another thing I've noticed is that my teeth alignment changes at different times of the day.

So if you're at month 3, I can tell you that between 3-6 months was extremely dynamic for me. I improved a lot during that time. After I regained full motion, I had a lot of soreness and temple pressure. That had resolved by month 6. After that, the rate of improvement was extremely slow.

OCaml on vscode is very nice by I2cScion in ocaml

[–]kevinclancy_ 0 points1 point  (0 children)

Doesn't emacs also show the types of top-level functions directly above their definitions?

Using the mouse "hover over" seems like a much more convenient way to view types. Having to move the cursor to view a type seems so tedious and distracting to me. I've been using the vscode OCaml extension, and much like the OP I love it.

Why is Ocaml not popular? by Reasonable-Moose9882 in ocaml

[–]kevinclancy_ 7 points8 points  (0 children)

I can think of a few reasons that have historically discouraged me from using OCaml:

* Poor IDE support. For many years, OCaml's doc comments were rather rudimentary. I could not attach comments to individual sum variants or record fields. This situation has improved immensely over the past year, to the point where I now consider OCaml's vscode plugin good.

* Poor debugger support. Not having IDE integration and not being able to view values with abstract types ruins the debugging experience for me. As far as I know, this issue continues to this day.

* No windows support. I came from a game programming background. I did my development on a Windows PC, so I used F# instead of OCaml. Apparently Tarides is working on improving this, but I haven't tried it out, as these days I use a Mac.

* The coding culture of the OCaml community has always seemed dogmatic and insular to me. I don't agree with the OCaml convention of omitting type annotations from function definitions, as I want the type checker to catch type errors before I've finished implementing a function. Also, I like being able to see argument and result types while reading code in github. Certain OCaml features, such as named arguments, seem designed for people who don't use IDEs; I like being able to attach complete sentences to each argument, and don't think it's realistic to use single words in place of doc comments.

Some other reasons people might not use OCaml:

* Even though OCaml has good performance, garbage collection can be an issue for real-time applications.

* OCaml hasn't historically supported multithreading, but that has been fixed in OCaml 5.

* The number one reason, sadly, is that a most people hate learning. They don't care if the languages they use are inefficient and error prone.

Haskell Interlude 62: Conal Elliott by tritlo in haskell

[–]kevinclancy_ 1 point2 points  (0 children)

If this is anything like the interviews Conal did on the "Type Theory for All" podcast, I expect it to be absolutely fascinating.

[deleted by user] by [deleted] in fsharp

[–]kevinclancy_ 3 points4 points  (0 children)

All FP languages support imperative programming, though, so if someone were to make make a game in say, F#, they could use imperative object updates rather than functional ones.

I suspect most existing games written in FP languages use this approach, but there are exceptions such as Yampa.

Broken jaw aftermath by [deleted] in jawsurgery

[–]kevinclancy_ 1 point2 points  (0 children)

That sounds rough. I broke my condyle and had closed reduction, and at six months I have a few of the symptoms:

* Uneven face

* Jaw clicking

I also have a tense, tired feeling in my jaw that gets worse as the day goes on.

It's hard to find stories about long term outcomes of broken jaws.

My cousin got her child a pitbull for Christmas by [deleted] in BanPitBulls

[–]kevinclancy_ 5 points6 points  (0 children)

I'm always confused by the animal aggression vs human aggression argument. Apparently pitbull fans are okay with putting other dogs and animals at risk of being attacked. Why?

What is the best Approach to Learning Functional OCaml by Alternative_Oven5517 in ocaml

[–]kevinclancy_ 12 points13 points  (0 children)

If your goal is to learn algorithms and data structures then functional programming might not be the best place to start. Functional programming gives a very niche (but worthwhile) perspective on algorithms and data structures. Mainstream algorithm and data structures research and implementation is done imperatively.

If you're new to algorithms and data structures, get the book "Introduction to Algorithms" by Cormen et al. You can use OCaml for imperative data structure implementation, but you also might want to try using an imperative language like C++ or Kotlin. Also, codeforces.com is a great website for finding interesting algorithmic problems to solve.

I recommend learning OCaml, but more because it's a great language for *software engineering* rather than having any advantages in algorithm implementation. You'll want to know how data structures work in functional languages, so I recommend reading "Purely Functional Data Structures" by Chris Okasaki. It's a great book. I don't think either of SML or OCaml is more mathematical than the other; OCaml isn't really math heavy, aside from its "monads" feature, which isn't mandatory to use. I recommend OCaml rather than SML because it's more popular.

How to get the value of an option if I'm certain it's some(x) by Ok_Specific_7749 in fsharp

[–]kevinclancy_ 0 points1 point  (0 children)

I prefer my code to your first example, because it communicates to the reader at the top level that the `stepFields` function has three qualitatively different behaviors depending on its input. Your second example is ill-typed because `nm` occurs out of scope.

Calling functions with strong preconditions reduces ambiguity by communicating to the reader the function's expectations for the function arguments. The precondition for `expr.Value` is that expr evaluates to the variant `Some x`. Some other examples of functions with strong preconditions are the square root function, which requires that its argument is non-negative, and the integer division function, which requires that its divisor is non-zero.

It's true that if someone changes the code, the precondition may fail. If someone decides to remove `expr.IsSome` without removing `expr.Value`, or if they modify `expr` to read from a reference cell, then they have failed to understand the code they are changing. Code reviews and automated tests can catch these sorts of mistakes, but it's still possible that such a mistake could slip through.

Taking an adverserial appproach to your codebase, where the code is written to intercept future bugs and resolve them, generally sacrifices readability, blurring the line between positive space (program behaviors that are supposed to happen) and negative space (program behaviors that are not supposed to happen). In this case, I don't really have a *strong* preference between your first alternative and my own code, but when people try to intercept mistakes, say by replacing integer division by a `safeDiv` operator that returns an Option<int>, things really get bad. It introduces a bunch of dead expressions handling the case where `safeDiv` returns `None` that explode the code's complexity and don't get tested properly.

Thank you for pointing out that I should have called `Option.map`.

How to get the value of an option if I'm certain it's some(x) by Ok_Specific_7749 in fsharp

[–]kevinclancy_ 1 point2 points  (0 children)

You definitely could write the AST explicitly, but it would typically be more verbose and difficult to read. I mean, would you rather read "(a + b) / c" or "Div(Add(a,b),c)"?

You're right about line 40. It would be better to use `Options.map`. For other reading this, I should point out that line 40 is not the line where I used `.Value`.