www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - D is the best tool for this!!! How do we tell them??

reply Emmanuel <emmankoko519 gmail.com> writes:
https://www.theregister.com/2024/08/03/darpa_c_to_rust/#:~:text=The%20term%20stands%20for%20TRanslating,do%20so%20is%20memory%20safety.


the DARPA project wants to translate all their legacy C code to 
Rust. they prefer using a programming language which will reject 
unsafe programs at compile times.

maybe one PULL request from the D community can???? showing how 
good D is for a job like this!!
Aug 03
next sibling parent reply monkyyy <crazymonkyyy gmail.com> writes:
On Saturday, 3 August 2024 at 18:52:42 UTC, Emmanuel wrote:
 https://www.theregister.com/2024/08/03/darpa_c_to_rust/#:~:text=The%20term%20stands%20for%20TRanslating,do%20so%20is%20memory%20safety.


 the DARPA project wants to translate all their legacy C code to 
 Rust. they prefer using a programming language which will 
 reject unsafe programs at compile times.

 maybe one PULL request from the D community can???? showing how 
 good D is for a job like this!!
Don't trust what they are saying, think backwards from their conclusions. They could have pick 50 other languages, they could have commissioned a new c subset and compiler, they could have made calls for new languge that ports c easily but have such and such safety features. Instead they picked rust, the language that killed firefox, has no final spec and by all accounts is painful to work with. They *wanted* to dig ditches to refill them. Why would they want this, well, congress made on-shoring technology a priority a few years back, while silicone valley was getting ready for the mass firings. From their prospective keeping Americans employable with stem skills is a responsible act for "the digital supply chain".
Aug 03
parent reply Paulo Pinto <pjmlp progtools.org> writes:
On Saturday, 3 August 2024 at 23:04:06 UTC, monkyyy wrote:
 On Saturday, 3 August 2024 at 18:52:42 UTC, Emmanuel wrote:
 [...]
Don't trust what they are saying, think backwards from their conclusions. They could have pick 50 other languages, they could have commissioned a new c subset and compiler, they could have made calls for new languge that ports c easily but have such and such safety features. Instead they picked rust, the language that killed firefox, has no final spec and by all accounts is painful to work with. They *wanted* to dig ditches to refill them. Why would they want this, well, congress made on-shoring technology a priority a few years back, while silicone valley was getting ready for the mass firings. From their prospective keeping Americans employable with stem skills is a responsible act for "the digital supply chain".
What killed Firefox are all the devs that ship Chrome everywhere with their Electron crap, and while complaining about Google, cannot care less to test anything else beyond Chrome.
Aug 04
next sibling parent reply aberba <karabutaworld gmail.com> writes:
On Sunday, 4 August 2024 at 08:20:25 UTC, Paulo Pinto wrote:
 On Saturday, 3 August 2024 at 23:04:06 UTC, monkyyy wrote:
 [...]
What killed Firefox are all the devs that ship Chrome everywhere with their Electron crap, and while complaining about Google, cannot care less to test anything else beyond Chrome.
Mozilla killed Firefox when the lost focus of their main product. Follow when they were spending their money.
Aug 04
next sibling parent reply aberba <karabutaworld gmail.com> writes:
On Sunday, 4 August 2024 at 09:51:48 UTC, aberba wrote:
 On Sunday, 4 August 2024 at 08:20:25 UTC, Paulo Pinto wrote:
 On Saturday, 3 August 2024 at 23:04:06 UTC, monkyyy wrote:
 [...]
What killed Firefox are all the devs that ship Chrome everywhere with their Electron crap, and while complaining about Google, cannot care less to test anything else beyond Chrome.
Mozilla killed Firefox when the lost focus of their main product. Follow when they were spending their money.
Firefox was really bad, it has little to do with any specific language IMO, it was an organizational failure. The DevTool relied upon by front-end devs was horrible. It's gotten better since then but now it's almost too late.
Aug 04
parent Martyn <martyn.developer googlemail.com> writes:
On Sunday, 4 August 2024 at 09:55:23 UTC, aberba wrote:
 On Sunday, 4 August 2024 at 09:51:48 UTC, aberba wrote:
 On Sunday, 4 August 2024 at 08:20:25 UTC, Paulo Pinto wrote:
 On Saturday, 3 August 2024 at 23:04:06 UTC, monkyyy wrote:
 [...]
What killed Firefox are all the devs that ship Chrome everywhere with their Electron crap, and while complaining about Google, cannot care less to test anything else beyond Chrome.
Mozilla killed Firefox when the lost focus of their main product. Follow when they were spending their money.
Firefox was really bad, it has little to do with any specific language IMO, it was an organizational failure. The DevTool relied upon by front-end devs was horrible. It's gotten better since then but now it's almost too late.
I have been a Firefox user since 2007. Still prefer it today. I did not experience the things others say about Firefox. I prefer the dev tools over Chrome to this day. Regardless - even if Firefox was absolutely perfect.. competing against other web browsers backed by top tech companies will always be problematic. On its left you have Microsoft which destroyed Netscape Navigator. Most Windows users will use IE 6/7/8/etc because its there. With Firefox, you had to download it (if you have even heard of it) On its right is Google Chrome (released 2008) heavily marketed by (obviously) google.. which the masses jumped on and used. As I say -- even if Firefox was the best web browser, it will never be the popular browser. Even if it was, it would be for a brief moment and, likely, would have been over 10 years ago. Most people do not care about their rights or any other thing. They just want to do something, and they will use what is likely reinstalled. Buy a new PC... already comes with Windows. Want a Web Browser... here is Edge! etc.
Aug 06
prev sibling parent reply matheus <matheus gmail.com> writes:
On Sunday, 4 August 2024 at 09:51:48 UTC, aberba wrote:
 ...
 Mozilla killed Firefox when the lost focus of their main 
 product. Follow when they were spending their money.
I think that "bundling" IE with windows (IE vs Netscape) and google telling users to try chrome on its biggest search engine helped then a lot against Mozilla too. I'm NOT evangelist, but I use FF on PC e Mobile because it gives me a better experience together with uBlock Origin and other plugins. Nevermind cases of youtube throttling or teams (microsoft) rejecting FF, in the latter I had that problem myself and it was "fixed" using a User-Agent Switch add-on on FF and cheating teams, which by the way worked perfectly after... nonsense. By the way, in this Forum with UBO blocking fonts.googleapis.com, ajax.googleapis.com gives me literally a instant load. (I ran private browsing). Finally I'm not saying FF is perfect, in fact there to opposite is quite true. But again I think it currently gives me better experience with UBO than the alternatives. Matheus.
Aug 05
parent aberba <karabutaworld gmail.com> writes:
On Monday, 5 August 2024 at 16:10:04 UTC, matheus wrote:
 On Sunday, 4 August 2024 at 09:51:48 UTC, aberba wrote:
 ...
 Mozilla killed Firefox when the lost focus of their main 
 product. Follow when they were spending their money.
I think that "bundling" IE with windows (IE vs Netscape) and google telling users to try chrome on its biggest search engine helped then a lot against Mozilla too. I'm NOT evangelist, but I use FF on PC e Mobile because it gives me a better experience together with uBlock Origin and other plugins. Nevermind cases of youtube throttling or teams (microsoft) rejecting FF, in the latter I had that problem myself and it was "fixed" using a User-Agent Switch add-on on FF and cheating teams, which by the way worked perfectly after... nonsense. By the way, in this Forum with UBO blocking fonts.googleapis.com, ajax.googleapis.com gives me literally a instant load. (I ran private browsing). Finally I'm not saying FF is perfect, in fact there to opposite is quite true. But again I think it currently gives me better experience with UBO than the alternatives. Matheus.
My use of a web browser is probably 10% browsing, 90% working with the devtools (front-end development). Until recently, Firefox wasn't a reliable browser to develop with. It was lagging behind and even now it's still loosing more users (https://stackdiary.com/mozilla-usage-decline-from-2022-to-2023/). Since 2020, there's been numerous articles about why Firefox is loosing users and how the foundation is spending funds. For regular browsing, even webkit should work just fine. However, Chrome now has the accumulative advantage. And it's doing just fine with C++ it seems
Aug 05
prev sibling parent reply monkyyy <crazymonkyyy gmail.com> writes:
On Sunday, 4 August 2024 at 08:20:25 UTC, Paulo Pinto wrote:
 What killed Firefox are all the devs that ship Chrome 
 everywhere with their Electron crap, and while complaining 
 about Google, cannot care less to test anything else beyond 
 Chrome.
Servo never shipping plays a role in firefoxs death A 8 year example of someone big running head first into a spiketrap; everyone since has no excuse to expect different results, Rust has a bad feedback loop of getting code running, compiling quickly and seeing if its work; their talking point of "it will be perfect when you get it compiling" evidently didnt save whatever was going on in firefox.
Aug 04
parent Paulo Pinto <pjmlp progtools.org> writes:
On Monday, 5 August 2024 at 01:37:38 UTC, monkyyy wrote:
 On Sunday, 4 August 2024 at 08:20:25 UTC, Paulo Pinto wrote:
 What killed Firefox are all the devs that ship Chrome 
 everywhere with their Electron crap, and while complaining 
 about Google, cannot care less to test anything else beyond 
 Chrome.
Servo never shipping plays a role in firefoxs death A 8 year example of someone big running head first into a spiketrap; everyone since has no excuse to expect different results, Rust has a bad feedback loop of getting code running, compiling quickly and seeing if its work; their talking point of "it will be perfect when you get it compiling" evidently didnt save whatever was going on in firefox.
If you think that was the reason, I have a bridge to sell.
Aug 04
prev sibling parent reply Guillaume Piolat <guillaume.piolat gmail.com> writes:
On Saturday, 3 August 2024 at 18:52:42 UTC, Emmanuel wrote:
 https://www.theregister.com/2024/08/03/darpa_c_to_rust/#:~:text=The%20term%20stands%20for%20TRanslating,do%20so%20is%20memory%20safety.


 the DARPA project wants to translate all their legacy C code to 
 Rust. they prefer using a programming language which will 
 reject unsafe programs at compile times.

 maybe one PULL request from the D community can???? showing how 
 good D is for a job like this!!
From translating heaps of C to D: it's not that easy sometimes. - Some C headers like j40.h and miniz.h use the "switch-based coroutine" and exploit the fact the case label can be anywhere to create push parsers. Rust match doesn't allow labels anywhere, but D does so you can do the switch-based coroutine. Example: https://gist.github.com/mrtrizer/a14c033a054c191d9d23bfa516ad8107 At least this case is easy in D. - Some C headers like j40.h and stb_image_resize2.h use header self-include to change macros and have some sort of templates. A single C header can include itself many times (imagine the poor lexer). When translating this, it can be tempting to just expand however the translated code may make more sense if done with a policy-based template and `mixin`.
Aug 04
parent reply Walter Bright <newshound2 digitalmars.com> writes:
On 8/4/2024 3:06 AM, Guillaume Piolat wrote:
 - Some C headers like j40.h and miniz.h use the "switch-based coroutine" and 
 exploit the fact the case label can be anywhere to create push parsers. Rust 
 match doesn't allow labels anywhere, but D does so you can do the switch-based 
 coroutine. Example: 
 https://gist.github.com/mrtrizer/a14c033a054c191d9d23bfa516ad8107
 At least this case is easy in D.
It's one reason why pattern matching in D will be a construct separate from the switch statement.
 - Some C headers like j40.h and stb_image_resize2.h use header self-include to 
 change macros and have some sort of templates. A single C header can include 
 itself many times (imagine the poor lexer). When translating this, it can be 
 tempting to just expand however the translated code may make more sense if
done 
 with a policy-based template and `mixin`.
ImportC can do translations of C to D, but not translations of non-trivial preprocessor metaprogramming. Problems aside, reports from the field are that ImportC can do maybe 90% of the job, the rest by hand. Still a big win. My experience hand-translating C to D is about 1000 lines per hour.
Aug 05
parent "Richard (Rikki) Andrew Cattermole" <richard cattermole.co.nz> writes:
On 06/08/2024 1:24 PM, Walter Bright wrote:
 On 8/4/2024 3:06 AM, Guillaume Piolat wrote:
 - Some C headers like j40.h and miniz.h use the "switch-based 
 coroutine" and exploit the fact the case label can be anywhere to 
 create push parsers. Rust match doesn't allow labels anywhere, but D 
 does so you can do the switch-based coroutine. Example: 
 https://gist.github.com/mrtrizer/a14c033a054c191d9d23bfa516ad8107
 At least this case is easy in D.
It's one reason why pattern matching in D will be a construct separate from the switch statement.
At the language level yes. At the implementation level the proposed solution is to deconstruct it into switch statements as they are already optimized. https://github.com/dlang/DIPs/pull/246/files#diff-5a287e7c096a0fb05f624ef7304d83cdc53adedafbd8af28d35d82f9dd97cb69R71 Kinda waiting on Mike atm (I know he's busy so not pinging currently).
Aug 05