News for hackers. Stuff that matters.
Re:Re: Moving from PHP to Go and Back Again by psergeant on Tuesday December 12, 2017 @01:33AM (#15903439)
I’d really like a strongly typed (or optionally typed) Python or Perl derivative. Rust feels most Perl-like so far.
Re:Re: Moving from PHP to Go and Back Again by patricklouys on Tuesday December 12, 2017 @01:35AM (#15903449)
Modern PHP is very nice to work with. Ignore the haters that haven't touched the language in 10 years.
Re:Re: Moving from PHP to Go and Back Again by Lazare on Tuesday December 12, 2017 @01:53AM (#15903518)
To be fair to the haters, even modern PHP can be horrible. The old nightmares are still around; we've just agreed to ignore them, and maybe deprecate a couple of the worst. (And ternary syntax is still broken, and the standard library is anything but standard.)

But yes, if you're working on a modern PHP project, there's a lot to love: A solid module system, an enormous sea of high quality libraries, type checking, a really nice deployment and scalability story, decent performance, good tooling (IDEs, debuggers, etc.), a servicable C-style syntax. For many purposes (not all!) it's ten times better than, eg, nodejs. (Which might seem like a low bar, I admit...)

Re:Re: Moving from PHP to Go and Back Again by nurettin on Tuesday December 12, 2017 @02:02AM (#15903560)
Is it better than nodets?
Re:Re: Moving from PHP to Go and Back Again by Lazare on Tuesday December 12, 2017 @07:33AM (#15905127)
nodets, as in typescript on node? I haven't personally tried it, but I imagine so, again depending on your particular use case.

I quite like Typescript as far as syntax goes, but I think PHP 7.1+ is comparable. And PHP has a lot more support, libraries, and better tooling in my view. For example, my experience in node land is there aren't really any good ORMs; PHP has multiple, including one (Doctrine) which is easily the equal in my view of the highly regarded Python SQLAlchemy. Similarly with routing, frameworks, templating, etc., there's a huge amount of maturity on the PHP side that's missing from node.

The big question is going to be in the process model. Node has an event loop; PHP doesn't. For most purposes, I think an event loop makes writing good code harder to no real benefit, but in some cases (eg, acting as the endpoint for a ton of open websockets) it can be a big win. If you do need that, then you should probably lean towards node over PHP, and sure, why not use typescript? But for the general case, I'd still lean towards PHP.

(Then again, there's also a ton of other languages and frameworks. Just because PHP - or node - might be better than the other for some task doesn't mean there aren't a dozen more languages better than both.)

Re:Re: Moving from PHP to Go and Back Again by nurettin on Tuesday December 12, 2017 @11:57PM (#15912116)
In your view, if someone created an ORM for node which focused on creating object graphs for tables and fields (a-la sqlalchemy) instead of focusing on SQL building syntax (a-la knex) would it be popular?
Re:Re: Moving from PHP to Go and Back Again by lpghatguy on Tuesday December 12, 2017 @02:15AM (#15903612)
Solid module system?

It's still the same as C, which is _not_ a solid module system.

Re:Re: Moving from PHP to Go and Back Again by patricklouys on Tuesday December 12, 2017 @03:10AM (#15903829)
I'm assuming he meant the dependency manager, which is really nice.

https://getcomposer.org/

Re:Re: Moving from PHP to Go and Back Again by Lazare on Tuesday December 12, 2017 @07:09AM (#15904979)
Correct. :)
Re:Re: Moving from PHP to Go and Back Again by powerslacker on Tuesday December 12, 2017 @02:11AM (#15903601)
I wrote some PHP last month and I still hate it :)

Though it has improved dramatically.

Re:Re: Moving from PHP to Go and Back Again by patricklouys on Tuesday December 12, 2017 @03:11AM (#15903834)
Did you write clean OOP code? You can still write bad code with it, no doubt about that.
Re:Re: Moving from PHP to Go and Back Again by bringtheaction on Tuesday December 12, 2017 @01:45AM (#15903479)
Re:Re: Moving from PHP to Go and Back Again by TurboHaskal on Tuesday December 12, 2017 @03:32AM (#15903923)
Why do you say that? I love both Perl and Rust, yet the latter doesn't feel very perlish to me.
Re:Re: Moving from PHP to Go and Back Again by psergeant on Tuesday December 12, 2017 @03:38AM (#15903951)
Seems it’s optimized for developer enjoyment and is a big language that allows for terse expression, as well as a few ways to achieve the same thing.
Re:Re: Moving from PHP to Go and Back Again by catnaroek on Tuesday December 12, 2017 @10:34AM (#15906275)
Any measure by which Rust allows for “terse expression” has to be horribly broken. (And I don't even dislike Rust.)
Re:Re: Moving from PHP to Go and Back Again by pjmlp on Tuesday December 12, 2017 @09:26AM (#15905736)
Maybe you should look at Crystal, a Ruby derivative.
Re:Re: Moving from PHP to Go and Back Again by dom96 on Tuesday December 12, 2017 @05:43AM (#15904495)
Have you looked into Nim?