18 ms·
Goro – An implementation of PHP written in Go
- tyingq 8y ago"Better caching of compiled code by allowing sharing of compiled or live objects (classes, objects, etc) between running PHP scripts" I'm a little confused on this piece, as PHP does have a cross process opcache. People also use things like apcu to share userspace things across processes (uses mmap).
- treve 8y agoI think the idea is for example creating an object in 1 PHP process, and modify it in the second. The point is there is no shared state in the running problem
- tyingq 8y agoWell, it mentions classes, for example. The opcache handles that already, cross process. For a live object, people tend to use apcu. It's not as nice as a shared object across 2 couroutines, but it's reasonably fast because it's using mmap and fairly fast serialization to share the object. So, what they are proposing is helpful. But, they seem to be assuming that PHP shares nothing across processes. That's just not true.
- johnwheeler 8y agoInteresting. This is a repo from Mark Karpeles, the former MtGox CEO
- waitwhatt 8y agoHah. You can lose people hundreds of millions of dollars worth of assets and because it is magic internet money and not real money, you are coding instead of in jail.
- artursapek 8y agoHe did spend some time in jail
- cobythedog 8y agoHe is currently CTO at London Trust Media (owners of Private Internet Access VPN): https://londontrustmedia.com/about/ https://londontrustmedia.com/about/ - (under "Holdings Executive Management")
- viraptor 8y agoAre you advocating for debtors prisons? If someone losses money you gave them, would you rather they were in prison, (living from your taxes) or working and repaying? Also if the bankruptcy proceeds as planned, nobody will lose real money. (Btc sale so far covers all the fiat they owe and a bit more)
- pvg 8y agoThere are a lot of ways to go to prison for mishandling other people's money that are not "debtors prison".
- cobythedog 8y agoI did not read the comment as advocating for debtors prisons. My understanding is that those were (are) for individuals who cannot pay a debt. Instead, I assume the parent commentor meant something more along the lines of a Bernie Madoff.
- PunchTornado 8y ago> PHP is having trouble keeping up with modern language which are these modern languages and which are the cases where it is not keeping up? IMO PHP is one of the languages where development is really quick and the ecosystem is flourishing.
- mattigames 8y agoA great way to look into the future of languages is checking how many people is learning it now compared to the last few years, a great tool for that is google trends and things don't look good for PHP: https://trends.google.com/trends/explore?date=all&geo=US&q=php%20tutorial,python%20tutorial https://trends.google.com/trends/explore?date=all&geo=US&q=p...
- ceejayoz 8y agoI'm not sure that's a great way to evaluate things. Add in "Laravel" and things look pretty different: https://trends.google.com/trends/explore?date=all&geo=US&q=php%20tutorial,python%20tutorial,laravel https://trends.google.com/trends/explore?date=all&geo=US&q=p... I know I personally steer any newbie away from Googling up "php tutorial" - most of them are horrible, full of bad coding practices and vulnerabilities. I steer them to a good framework and suggest they peruse its docs.
- CydeWeys 8y agoThis is a more fair comparison: https://trends.google.com/trends/explore?date=all&geo=US&q=php%20tutorial,python%20tutorial,Laravel%20tutorial https://trends.google.com/trends/explore?date=all&geo=US&q=p... You can't just compare searches for tutorials on one platform against an entire other platform itself like that. The vast, vast majority of PHP out there does not use Laravel.
- TigerHimself 8y agoSo you are saying that PHP is dying since 2004. That’s ridiculous. There are new languages and more alternatives today that’s it.
- EGreg 8y agoWhat I want to know is, can I just compile PHP under iOS and Android and run it? Why doesn’t PHP work out of the box on those systems if compiled?
- jacob019 8y agoCan I run WordPress on it today?
- mcrittenden 8y agoNo: https://github.com/MagicalTux/goro/blob/master/README.md#todo https://github.com/MagicalTux/goro/blob/master/README.md#tod...
- jacob019 8y agopre-alpha, bummer. Over the years I've had quite a few friends and family ask me to arrange hosting of their wordpress sites. Generally I refuse because wordpress has a long history of security problems. An alternate interpreter with sandboxed execution could solve a lot.
- nkozyra 8y agoI don't see what it fixes. You're just replacing an interpreter and in all likelihood bundling a web server. PHP 7 is a pretty solid language. I don't like WordPress at all, but there's so much cruft, legacy nonsense and plugin garbage that you won't win that battle.
- jacob019 8y agowell obviously we won't win the performance battle, and it may be impossible to protect the database and user data, but sandboxed execution with a virtual filesystem could protect the overall system, keep it from joining botnets and sending spam, etc.
- nkozyra 8y agoOk, but think about how many other ways you could fix that by wrapping battle tested interpreters.
- 1337shadow 8y ago
- azhenley 8y agoAny chance someone wants to do a benchmark to compare the performance of this to other PHP implementations?
- tmh88j 8y agoI'd rather see a simple web app made with this benchmarked against one made with Phalcon. I know that's comparing apples to oranges given that this is an implementation and Phalcon is a framework, but it would be interesting to see if this approach is any faster than writing a framework from extensions in a faster language
- muglug 8y ago> PHP is a nice language but is having trouble keeping up with modern languages It's only "having trouble" because it can't change its API from month to month to match whatever's in vogue. A majority of the web still runs on some variant of PHP, and that guarantees that it's not dying anytime soon. More broadly, it seems the author wants to create a version of PHP that's not focussed on web requests, which is sort of the entire point of PHP.
- vlunkr 8y ago> it can't change its API from month to month to match whatever's in vogue This is true of every language used on the web. That's why it's important to start out with the right choices, which in many instances PHP did not do, and is slowly trying to recover.
- jimnotgym 8y agoA majority of the web runs on one of a handful of programs that use php...WordPress, Magento...
- tgtweak 8y agoWhile true, there is still a tremendous amount of the web that is powered by php and not using WordPress or Magento. Facebook, Yahoo, Wikipedia, even Google.
- baroffoos 8y agoFacebook forked PHP to make Hack to try and make PHP usable. Yahoo is yahoo. Wikipedia wouldn't have the resources to change anything. Google has a wiki page for their developers telling them to never ever use PHP for any google project.
- wolco 8y agoThose facebook improvements made there way back into the core. Google might be able to move quicker if they allowed php. Facebook killed them in social. The type of products google can offer is limited by this decision.
- tbrock 8y agoMaybe this one will free some memory once in a while.
- Aeolun 8y agoBut... why? If you are going to write a go program to run PHP to use go specific features, why use PHP at all?
- nkozyra 8y agoOne common reason is to port/enable feature-specific legacy code without having to drag along a standalone interpreter. It can also be used as a common in-application scripting language.
- TheDong 8y agoA perfect example of error handling in go in the wild: https://github.com/MagicalTux/goro/blob/3cb3dfe0eef910c03e415e68ca29d7928c14e68a/core/compile-for.go#L117-L152 https://github.com/MagicalTux/goro/blob/3cb3dfe0eef910c03e41... More php interpreters is of course nice.
- hpbd 8y agoI don't understand. I have a C background. What is wrong with that?
- nkozyra 8y agoProbably the repetition of if err != nil {} You get used to that pretty quickly in Go, but it still looks messy to a lot of people.
- dymk 8y agoAnd so it's clear to others, this probably the worst possible way for a language to go about implementing error handling (maybe aside from just not having any mechanism outright and terminating). But alas, those are the choices that the Go language made.
- isodude 8y agoIs it really though? I've tried out Exceptions in most languages and Go's error handling stuck out to me as the first one that is clear what it does, which of course is the mantra of the language.
- TheDong 8y agoExceptions are a strawman. Compare it to another modern language such as rust. Go does not have a stdlib mechanism for converting error types into each other (akin to rust's Into), it doesn't have the idea of mapping values together (akin to rust's carrier operator which is basically like monad do syntax), it doesn't have a way to create a list of errors by default (akin to 'cause' in rust), it doesn't have a way to generate concrete error types for your functions (like the 'failures' or 'error-chain' libraries in rust, which can't be written in go due to a lack of macros and generics and sum types). It doesn't have a way to match on all possible concrete error values (akin to 'match' in rust or other sum-type things) or to do thing slike '.and_then' or '.map_err' or so on. Go's error handling is downright insulting in a language that wasn't built at the same time as c.
- rs86 8y agoFunny how so much is missing. I mean what does work?
- merlincorey 8y agoSince the author is one of the MtGox folks, this comment is pretty hilarious, possibly accidentally.
- rs86 8y agoYes, it was accidental. But I had a good laugh. Thanks
- krapp 8y agoOne of the most "hip to hate" languages implemented in one of the most "hip to love" languages...
- agumonkey 8y agowait for js.rs
- crimsonalucard 8y agojs.hs
- aylmao 8y agots.hs
- throwaway413 8y agoUsername checks out.
- agumonkey 8y agothat's almost a SKI combinator
- ChrisSD 8y agoYou joke but that's very likely to happen eventually if it hasn't already. At the very least I wouldn't be surprised if Mozilla made a prototype JS engine in Rust.
- mattdeboard 8y agoYeah buddy. https://servo.org/ https://servo.org/ Also there is already amazing work for Rust and WASM https://rustwasm.github.io/book/ https://rustwasm.github.io/book/
- 8y ago
- cozzyd 8y agoDoes it reproduce the ternary operator order "feature?"
- pippy 8y agoWhy is mcrypt listed as a future extension? it's removed in the latest PHP version and probably best to not even bother with
- deleted 8y ago[deleted]
- Solar19 8y agoI don't like unnecessary layers. Interpreted languages waste silicon and energy. I've heard startups justify using Ruby or PHP by saying "servers are cheap", which is just a bad engineering mindset. Instead of building PHP apps on a PHP platform built in Go, people should just build apps in Go. Or in C++, D, Nim, F#, C#, or even Java 8 or 10 with that new AOT compiler. (I think F# and C# can also be compiled in advance with CoreRT, but even if they can't, they're a huge upgrade over any interpreted language.) I would mention Rust except that it's terrible. All popular programming languages in our timeline are bad, and deter millions of smart people from the profession. But Rust is extraordinarily bad and should be replaced.
- untog 8y ago> I've heard startups justify using Ruby or PHP by saying "servers are cheap", which is just a bad engineering mindset. But a sensible startup mindset. Use whatever setup allows you to get things up and running the quickest. By the time you run into scaling problems brought about by a choice to program in Ruby (if you ever do) you'll have a viable product, and can transition pieces away as you see fit.
- JoshuaDavid 8y ago> All popular programming languages in our timeline are bad Consider the possibility that you consider all of the popular languages bad because there is something about "bad" languages which causes them to become popular. For example, I notice that all of the examples of "bad" languages are ones which let you push out buggy software that is "good enough".
- deleted 8y ago[deleted]
- hbcondo714 8y agoFor C#, checkout PeachPie which allows you to run PHP applications on .NET Core including WordPress - https://www.peachpie.io/2017/02/wordpress-announcement.html https://www.peachpie.io/2017/02/wordpress-announcement.html
- jchw 8y agoPeachPie is really interesting. I haven't had a chance to use it, but the most fascinating bit to me is that it can compile PHP to .NET. Could be a great way to incrementally move legacy code if you like writing servers in .NET, potentially. I do wonder how things like Wordpress extensions and dynamically generated code work, though. phpBB, for example, generates PHP files at runtime for its formatting engine (s9e TextFormatter, it's quite a nice library.)
- utam0k 8y agoAwesome.