News for hackers. Stuff that matters.
Re:We Run iSCSI over the Internet by qdotme on Wednesday April 29, 2026 @09:47AM (#47948426)
Thanks! Let me know if you have any questions - I've long wanted to write something "system-level" in Elixir.
Re:We Run iSCSI over the Internet by kajman on Friday May 01, 2026 @02:45PM (#47978466)
I've bounced off learning (hobby-tier) Elixir a few times now. For me, the gradual type system combined with the functional flow has been hardest to wrap my head around when it comes to solving problems.

I'm curious about how you approached handling a lower-level protocol in Elixir. When you began implementation, did you start thinking at the level of packets as structs, or maybe first as just maps that flowed through functions?

Re:We Run iSCSI over the Internet by qdotme on Friday May 01, 2026 @03:33PM (#47979172)
Pretty much functions with pattern matching all-across, passing around bitstrings, relatively dynamically typed.

Grab a buffer, make sure it's at least as long as BHS, shove into BHS, ok, make sure it's at least as long as what the BHS requires...

Pattern matching is the hidden power of Elixir that's probably the hardest to get fluent with, it's IMHO harder than Rust's equivalent (because of gradual typing!) - but when it works it blows Pythons' match syntax way, way out.

  # Example: Login Request with immediate = 0x03 | 0x40 = 0x43.
  defp parse_lengths(<<
         _reserved::1, _i_bit::1, opcode::6,
         _flags::8,
         _specific1::16,
         ahs_length::8,
         data_length::24,
         _rest::binary
       >>) do
    {:ok, opcode, ahs_length * 4, data_length}
  end

  defp parse_lengths(_), do: {:error, :invalid_bhs}
Re:We Run iSCSI over the Internet by kajman on Friday May 01, 2026 @04:08PM (#47979604)
That is an interesting example, thank you for the insight. It is amazing how simple logic is when you're able to front-load pre-reqs into a pattern match, but the idea of defining a function multiple times still feels "wrong" to me for now.

Overall, it's really cool to see Elixir applied like this. Congrats on the launch!

Re:We Run iSCSI over the Internet by qdotme on Friday May 01, 2026 @05:45PM (#47980825)
Thanks! It's truly a special concept somewhere between an overload and a pattern match. And unexpectedly performant - most of these are just type coercions, that resolve compile-time.