Well-known software developer specializing in large-scale database-driven web sites. Usually I use Perl. I speak at too many conferences. https://allaroundtheworld.fr/
I know what you mean and people have pointed this out a few times. The reason for this is when I mention that this is designed to be "backwards-compatible, but also allows the overall language to grow."
By having that extra level of indentation and putting the class definition in a block, we guarantee that, unless you're doing something really, really strange, it's backwards-compatible. That's because this code could never have compiled on older versions of Perl. The introduction of that block structure gives us the freedom to do anything in that block we feel is necessary, but companies can rest assured that they can still upgrade without our changing anything that currently exists.
As I've mentioned this is only a slight pet peeve and doesn't really impact me all that that much one way or another. Raku using the nested blocks alone would be a good reason for using that.
But I do feel a bit daft nonetheless: A top-level method wouldn't compile either, just like one nested within a class. On the other hand, once you bring in stuff like Moops, Dios or just Function::Parameters, everything is possible.
Having everything isolated in a block is a good visual boundary, definitely agree on that, but "could never have compiled" is a bit hard to parse for me on a Monday 😉
Well-known software developer specializing in large-scale database-driven web sites. Usually I use Perl. I speak at too many conferences. https://allaroundtheworld.fr/
This is something that was pointed out to me (by Sawyer? can't recall) a while ago as an unintended benefit. In short, if I wanted to repurpose syntax such as my Dog $spot, I'd be stepping on existing syntax. However, by creating a new syntax with an unambiguous scope and is guaranteed not to run on older versions of Perl (short of something really bizarre going on), we have a brand new syntax which is guaranteed not to clash with existing usage.
Further, because its scope is well-defined, we can play around with new syntax in that scope. Just adding a has function or a method keyword to the language could break all sorts of existing code that is already trying to do something like that. But by doing it in a new scope, we're safe.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
I know what you mean and people have pointed this out a few times. The reason for this is when I mention that this is designed to be "backwards-compatible, but also allows the overall language to grow."
By having that extra level of indentation and putting the class definition in a block, we guarantee that, unless you're doing something really, really strange, it's backwards-compatible. That's because this code could never have compiled on older versions of Perl. The introduction of that block structure gives us the freedom to do anything in that block we feel is necessary, but companies can rest assured that they can still upgrade without our changing anything that currently exists.
As I've mentioned this is only a slight pet peeve and doesn't really impact me all that that much one way or another. Raku using the nested blocks alone would be a good reason for using that.
But I do feel a bit daft nonetheless: A top-level
method
wouldn't compile either, just like one nested within aclass
. On the other hand, once you bring in stuff like Moops, Dios or just Function::Parameters, everything is possible.Having everything isolated in a block is a good visual boundary, definitely agree on that, but "could never have compiled" is a bit hard to parse for me on a Monday 😉
I don't understand the argument. How is "it can't compile" backwards compatible? It's new syntax that should blow up in earlier versions. And it does.
Aside from that, a class declaration with / without a block seems to blow up the same way:
So what is the argument?
This is something that was pointed out to me (by Sawyer? can't recall) a while ago as an unintended benefit. In short, if I wanted to repurpose syntax such as
my Dog $spot
, I'd be stepping on existing syntax. However, by creating a new syntax with an unambiguous scope and is guaranteed not to run on older versions of Perl (short of something really bizarre going on), we have a brand new syntax which is guaranteed not to clash with existing usage.Further, because its scope is well-defined, we can play around with new syntax in that scope. Just adding a
has
function or amethod
keyword to the language could break all sorts of existing code that is already trying to do something like that. But by doing it in a new scope, we're safe.