[clug] Bad features of programming languages.

James Ring sjr at jdns.org
Thu Apr 20 02:16:32 UTC 2023


On Wed, Apr 19, 2023 at 6:56 AM Brenton Ross via linux <
linux at lists.samba.org> wrote:

> Hi,
>
> I am having an interesting conversation about bad features of
> programming languages.
>
> I am wondering if anyone from the group has some thoughts on what they
> hope never to see in a programming language, or just things you really
> dislike.
>

One thing that bit me when I was learning Go was the behavior of the
"defer" keyword:

```
func something() {
  for i := range ... {
    x := open_something_expensive()
    defer release_resources(x)
    do_something(x)
  }
}
```

The problem is that the `release_resources` deferred statements are run at
the end of the something() function, not at the end of each loop iteration.


> Brenton
>
>
>
>
> --
> linux mailing list
> linux at lists.samba.org
> https://lists.samba.org/mailman/listinfo/linux
>


More information about the linux mailing list