[–] 8 points 6 months ago* (1 child)

Agreed on all points except possibly semicolons. Automatic semicolon inference has a very big language footprint, similar to the range syntax that the author disliked.

That said, I don't think the vararg suggestion belongs in this list of syntax changes. For this feature to be useful, it has to be at least powerful enough to replace format!, but the current type system isn't even remotely expressive enough to do this. I imagine this would require something like C++-style templates or comptime reflection, which goes well beyond syntax changes.

I added the author's other texts to my reading backlog too. Looks interesting.

  • source
  • [–] 1 point 1 year ago

    I didn't really understand the details of what you're making, but if you want to generate a random variable with entropy x, the straightforward approach would be to use Σ = { n | 1≤n≤⌈2^x⌉ } as the alphabet and start with a uniform distribution (which overshoots the entropy target) and slightly skew the distribution to reduce entropy to hit the target x. Then you can map Σ to your desired set (f64 or Vec in your case?) using an injection, since that preserves entropy.

  • source