Named arguments are coming in PHP 8
101–110 of 140 posts
Re: Named arguments are coming in PHP 8
#102Earlier quoted context omitted.
> There's a tension in PHP-land between [...] hobbyist-hacker [vs] enterprise-scale IMO the same tension exists in Python. The hobbyist-hackers are using the language to write small-ish scripts, and the enterprise-scale developers are working on million-line codebases. Unfortunately for the hobbyist-hackers, at some point (perhaps when the BDFL started working at Dropbox), the focus of the language shifted from the f…
You'd have a point if there were any changes that are being introduced and putting developers on a straight-jacket. But I don't see this tension at all. What is recent on Python3 that makes it hostile to hobbyists? The new features are optional, it's not like Python is forcing people to adopt mypy.
Python has become a very complex language [0], and the complexity continues to increase. IMO it's too much for people who only write code for, say, a few hours a week.
> The new features are optional
I hope Python isn't becoming a "choose your own subset" language like C++.
Re: Named arguments are coming in PHP 8
#103When I was learning Verilog HDL, named parameters are commonly used and highly encouraged. I wondered why more traditional programming languages didn't use this concept aswell for the same reasons the article goes into.
Re: Named arguments are coming in PHP 8
#104Ultimately every high level languages are converging to have the feature set of Kotlin, its nice to see them getting closer and closer.
Python has it since ever.
Re: Named arguments are coming in PHP 8
#105Earlier quoted context omitted.
> There's a tension in PHP-land between [...] hobbyist-hacker [vs] enterprise-scale IMO the same tension exists in Python. The hobbyist-hackers are using the language to write small-ish scripts, and the enterprise-scale developers are working on million-line codebases. Unfortunately for the hobbyist-hackers, at some point (perhaps when the BDFL started working at Dropbox), the focus of the language shifted from the f…
> Python now has a complex type system - that many developers never use. Python doesn't have a complex type system. How could it when, to this day, it doesn't bundle a type-checker? Python had a way to annotate functions (PEP 3107), which the community largely used for type-hinting, so Python introduced better support for type hints (PEP 484 and various extensions since).
Re: Named arguments are coming in PHP 8
#106> named arguments allow you to pass input data into a function, based on their argument name instead of the argument order Granted, I'm not a PHP developer, but I can't understand why a change like this would be controversial. It sounds like it's optional, and would help greatly to reduce mistakes when passing arguments to functions? Having multiple lines of things being passed to a function may look odd to some, but…
It's only optional when you're writing code. Even if you don't use features in your own projects you're undoubtedly going to be reading a lot of other's code, which may or may not use these features, and from that perspective added language complexity is a burden.
Re: Named arguments are coming in PHP 8
#107"a significant impact on my day-to-day programming life"...seriously, what a bunch of shite
Exactly! Who the hell programs in PHP anymore.
Re: Named arguments are coming in PHP 8
#108I've often wondered why there was no "default" keyword, so you could call a function like this: foo('first arg', default, 'third arg'); Named parameters will do but they are more verbose. Speaking whishes, method overloading would be great.
Having switched from 80% Java (20% about 5 other languages) to probably 75% Kotlin over the last year, one of my absolute favorite things named arguments. When you name your arguments, simply supplying them will use the default if one has been specified. If one hasn’t been specified then you must provide it when calling and your compiler/IDE will definitely let you know. I used to go out of my way with method overloa…
And yes overloading is more about different types for me. I guess I got accustomed to it with C# and nowadays Elixir. PHP 8 has union types so I guess it will do.
Re: Named arguments are coming in PHP 8
#109Earlier quoted context omitted.
Why not use a dictionary or parameter object when you get past 2 arguments? Or is that not a thing in PHP?
I'd think that such a solution doesn't solve but merely moves the problem. A method with N arguments, where N > 2, with a call that is messy due to the number of arguments could instead take a single argument being a parameter object where the constructor for the parameter object takes the same N arguments. A constructor with N arguments with a call that is messy due to the number of arguments ...
Re: Named arguments are coming in PHP 8
#110> named arguments allow you to pass input data into a function, based on their argument name instead of the argument order Granted, I'm not a PHP developer, but I can't understand why a change like this would be controversial. It sounds like it's optional, and would help greatly to reduce mistakes when passing arguments to functions? Having multiple lines of things being passed to a function may look odd to some, but…
Granted, I'm not a PHP developer, but I can't understand why a change like this would be controversial. It sounds like it's optional, It's only optional when you're writing code. Even if you don't use features in your own projects you're undoubtedly going to be reading a lot of other's code, which may or may not use these features, and from that perspective added language complexity is a burden.