Live data from Hacker News

Wuffs’ PNG image decoder

nigeltao.github.io

11–20 of 144 posts

Re: Wuffs’ PNG image decoder

#11

> Also, unlike Go or Rust, Wuffs’ memory safety is enforced at compile time, not by inserting runtime checks that e.g. the i in a[i] is within bounds or that (x + y) doesn’t overflow a u32. Am I missing something, or is this statement simply wrong? Have not used Go, but Rust checks its stuff at compile time as far as I know.

I think it’s right: https://uploads.peterme.net/nimsafe.html

Re: Wuffs’ PNG image decoder

#12
post #7

My favorite part of the Wuffs github page has to be the definition it gives for Dependent Types > ...Dependent types are a way to implement compile-time bounds checking, but they're not the only way, and there's more to programming languages than their type systems. Wuffs does not use dependent types. Wuffs looks really interesting! I don't think I've ever even heard of a language that is designed to only be used in…

>I don't think I've ever even heard of a language that is designed to only be used in an auxiliary role along side another general purpose programming language!

Embeddedable scripting languages come to mind. E.g.:

"Lua is a lightweight, high-level, multi-paradigm programming language designed primarily for embedded use in applications."

Re: Wuffs’ PNG image decoder

#13
post #7

My favorite part of the Wuffs github page has to be the definition it gives for Dependent Types > ...Dependent types are a way to implement compile-time bounds checking, but they're not the only way, and there's more to programming languages than their type systems. Wuffs does not use dependent types. Wuffs looks really interesting! I don't think I've ever even heard of a language that is designed to only be used in…

lex, yacc?

Re: Wuffs’ PNG image decoder

#14

> Also, unlike Go or Rust, Wuffs’ memory safety is enforced at compile time, not by inserting runtime checks that e.g. the i in a[i] is within bounds or that (x + y) doesn’t overflow a u32. Am I missing something, or is this statement simply wrong? Have not used Go, but Rust checks its stuff at compile time as far as I know.

Yes, Rust checks a lot of things at compile time, but not all. For example, dynamic bounds checks (indexing into a Vec or slice).

Re: Wuffs’ PNG image decoder

#15
post #6
post #4

Earlier quoted context omitted.

Looks like there isn't an encoder for PNG: https://github.com/google/wuffs/tree/main/std/png Given the project goals, I guess most encoders don't make a lot of sense: For image encoding you basically provide an "x * y * bytes_per_pixel" memory area and an encoder does its magic on that. There isn't really any complicated untrusted input in that case.

Darn, I had a handful of NumPy arrays which could use a fast encoder.

But I'm sure there are plenty of fast encoders? Wuffs isn't the path to a fast encoder. It's a path to something safe that is also pretty fast.

If you're encoding PNGs from NumPY arrays you don't care at all about safety.

If, for some reason I can't quite comprehend, whatever encoder you have on hand isn't fast enough, you can just disable compression optimizations -- but at that point you may as well be writing out a bitmap.

Re: Wuffs’ PNG image decoder

#16
post #12
post #7

My favorite part of the Wuffs github page has to be the definition it gives for Dependent Types > ...Dependent types are a way to implement compile-time bounds checking, but they're not the only way, and there's more to programming languages than their type systems. Wuffs does not use dependent types. Wuffs looks really interesting! I don't think I've ever even heard of a language that is designed to only be used in…

> I don't think I've ever even heard of a language that is designed to only be used in an auxiliary role along side another general purpose programming language! Embeddedable scripting languages come to mind. E.g.: "Lua is a lightweight, high-level, multi-paradigm programming language designed primarily for embedded use in applications."

Ah, of course. But opposite use case!

Lua is used at the very top level of a program, sometimes its even user accessible!

Wuffs is the exact opposite, it is designed for use in the deepest levels of a program!

Very cool idea.

Re: Wuffs’ PNG image decoder

#18
post #7

My favorite part of the Wuffs github page has to be the definition it gives for Dependent Types > ...Dependent types are a way to implement compile-time bounds checking, but they're not the only way, and there's more to programming languages than their type systems. Wuffs does not use dependent types. Wuffs looks really interesting! I don't think I've ever even heard of a language that is designed to only be used in…

Ragel might be a related example: http://www.colm.net/open-source/ragel/
Post reply on HN