Hacker Newsnew | past | comments | ask | show | jobs | submit | msavara's commentslogin

Amateur here. This is good for what? Why somebody should use this instead of normal?


From the README:

> Project goals: Both-way interoperability, Full .NET compatibility, Security, Cross-platform development, Increased performance - https://github.com/peachpiecompiler/peachpie

So seems they're aiming to use the PHP language but on a different runtime, for the listed reasons. Sounds kind of out there, but seems at least the .Net Foundation supports it, I'm guessing for the same reasons.


IMHO, besides the fun to create such a project (and all the thibgs you learn while doing it), it's not for much. It tries to bring a technology somewhere (presuambly the desktop, as asp.net and PHP are already comparable) it's not designed for - which will bring you in trouble sooner or later. It's like JavaScript on the server, it's ok but there are languages better suited for this environment.

It's much faster to learn C# in the long term than to run PHP on top of .Net.


C# has poor man's PHP baked in these days:

https://learn.microsoft.com/en-us/dotnet/csharp/language-ref...

And, it's getting better over time:

https://github.com/dotnet/csharplang/issues/4935

This is essentially how I respond to web requests in my codebases right now:

  var table = $@"<table>
    <tr><th>Name</th></tr>
    {string.Join('\n', items.Select(i => $"<tr><td>{i.Name}</td></tr>"))}
  </table>";


The defining feature of PHP isn't really string templating, but its shared-nothing architecture.

https://slack.engineering/taking-php-seriously/

I would consider poor man's PHP as something to reimplement that architecture, rather than any particular language feature.


Hi, my name is:

   <script>Alert("hi")</script>


I fail to see why anyone sane would use this way over Razor files.


I use it to avoid the gauntlet of AspNetCore dependencies and weird editor bs around cshtml files.


Kind of makes my point then.


Migrating a legacy PHP code-base to .net maybe


we have attempted to use it for that, but it was really hard and we ended up rewriting from scratch.

The activity graph on GitHub says it is mostly dead. There is some activity, but at best it is in maintenance mode. It used to be sponsored, but not anymore IIRC

https://github.com/peachpiecompiler/peachpie/graphs/contribu...


It looks like this compiles PHP code to a .net binary but it doesn't support all of PHP so it's kinda useless for most projects.

Benefits of this are dubious at best. The php interpreter is already a low level C project so why replace that with .net? Makes no sense.


A major difference will be that PeachPie produces a compiled deploy artefact, while mainstream PHP is interpreted (albeit with heavy opcode caching and a JIT in production)


> The php interpreter is already a low level C project so why replace that with .net?

You are comparing apples with pies here. PHP is a interpreted language, while .NET is a compiled target.

However, this peachpie project seems to be far from stated goal and more of a research project currently.


May also be useful for creating automatic language support from a single codebase. For example, Amazon uses JSII to build a typescript library into Python, Go, dotnet, etc.

Maybe this tooling will help add PHP to that list.

That way you are not maintaining 6 codebases.

https://github.com/aws/jsii


I'm not sure why anyone would use it, but it was probably a fun project to make. I do think the statement on their landing page which reads: "Compile and run PHP on top the modern, secure and highly performant .NET runtime" perhaps is a little disingenuous. This might just be me, but I read it as though they imply that PHP isn't those things, which would be a silly statement to make in 2024.


You have a php project, and you want to use .net libraries.


For obfuscation reasons mainly. Hide your genius code from a php base so your IP is not poached/discovered by Amazon and the likes who love to get brilliant open source made project, move a line and call it their own.


Some might dislike your snark but obfuscation is a good use for this.


Dear Facebook. Still. I dont trust you.


Anybody here who is using zig on daily basis?


I use Zig for all my hobby projects:

- A pixel art editor https://github.com/fabioarnold/MiniPixel

- A Mega Man clone https://github.com/fabioarnold/zeroman

- Zig Gorillas https://github.com/fabioarnold/zig-gorillas

And most recently I had the opportunity to build a visualization for TigerBeetle's database simulator: https://sim.tigerbeetle.com

Before I was using C++ and Zig has been an improvement in every way.


That mega man clone is great. The movement feels exactly how I remember mega man 3 feeling. You absolutely nailed it. I also appreciate how you've set up the code, with the build script being written in zig. I checked the code out, compiled it, ran the web server and bam! It just worked. It doesn't seem like that should be a big deal, but competence is such an exotic bird in these woods that I appreciate it whenever I see it.


How did you not name that zigorrilas?


I don't know about "daily" right now (I've had to take a break due to obligations), but I'm working on a modern implementation of the Self programming language with actor capabilities: https://github.com/sin-ack/zigself

It's nowhere near usable yet, but Zig has been a joy to work with for over a year, and I can definitely see myself using it for a big piece of software.


Most days. Just switched to linux to access latest version and features, especially loving the new 'packed struct(u32)' for some low level SoC work (Register representation). I get compile errors if I miscount the bits, and I managed to get some type safety, and not a single 'shift', 'and' or 'or' sign in sight!

Looks like I'll be porting to 0.11.1 as soon as the documentation is in place... I hope they slow down soon, already feels complete. The WASM support is amazing, much smaller outputs than the other options I tried (Java & Go). Great work team!


I took a year off, and one of the things I did was learn Zig. I've built a number of libraries, including one of the currently more popular HTTP server libraries (https://github.com/karlseguin/http.zig).

A number of my libraries are used for https://www.aolium.com/ which I decided to write for myself.

I try to write a bit every day with the benefit that I can "waste" time digging into things or exploring likely-to-fail paths.


I am building an on-premise annotation platform for medical image data (MVA.ai) where it is used for both backend and frontend (WASM). Really enjoy the language, with the key aspects being the low level control and performance, the build system and cross-compilation, comptime for generics, the easy integration of existing C libraries and the support for WASM. Manual memory management is sometimes a bit tedious, but you get used to it quite quickly. On the other hand, being able to use different allocators can even give you something like 'lifetimes'.


I'm slowly writing a game with it in my own time and previously worked on an in-memory cache for smart metering full-time. It's been nice to play with and my goto language for prototyping since arond 0.5.0.


Everyone where I work does. :)


We trade ten million dollars a day of shitcoin derivatives using zig. Should be more soon :). We're probably stuck on 0.10.1 until async makes it back in though.


That's a pity, we were looking forward to it.


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: