www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - Asking for D solution

reply Alexander Tretyak <alextretyak2 gmail.com> writes:
Hello.

I'm looking for someone who has plenty of experience in the D 
programming language.

I have some task, which I hope will be added to Rosetta Code.
This task is based on pqmarkup, and is called pqmarkup-lite.

The specialty of this task is formatting characters of pqmarkup 
{paired quotation marks themselves, and Н, Р, С, Т, О, which 
allow both Latin and Cyrillic writing} go beyond ASCII. This 
significantly complicates working with input UTF-8 string 
directly (especially in languages [like C++] which have no 
built-in UTF-8 support).

I've already translated the [original implementation in 
Python](https://github.com/pqmarkup/pqmarkup-lite/blob/master/pqmarkup_lite.py)
of this task into C++ (there are two implementations: [using
u16string](https://github.com/pqmarkup/pqmarkup-lite/blob/master/
pp/utf16/utf16.cpp) and [using UTF-8
string](https://github.com/pqmarkup/pqmarkup-lite/blob/master/cpp/utf8/utf8.cpp)).
Also there is a [Nim 
translation](https://github.com/pqmarkup/pqmarkup-lite/blob/master/nim
pqmarkup_lite1.nim) by Luc Secouard.

And now I'm looking for people who can translate this task into 
other languages (D, Rust, Swift, etc.), and then I will compare 
all implementations by code readability and by performance.

So, can someone provide the most idiomatic D solution to this 
task?
I can pay for that (not very much though).
Jun 07
parent jfondren <julian.fondren gmail.com> writes:
On Monday, 7 June 2021 at 23:40:52 UTC, Alexander Tretyak wrote:
 And now I'm looking for people who can translate this task into 
 other languages (D, Rust, Swift, etc.), and then I will compare 
 all implementations by code readability and by performance.

 So, can someone provide the most idiomatic D solution to this 
 task?
 I can pay for that (not very much though).
This isn't quite what you're asking for, so no need to pay: https://github.com/jrfondren/pqmarkup-lite/tree/master/d This adds tests.d which is written in the style of tests.py, and pqmarkup_lite.d which is written in the style (with more differences required) of pqmarkup_lite1.nim. So this is more of a demonstration of D's range than of particularly idiomatic D. Due to some mistakes that I made while rewriting the Nim, this version is still failing seven(+2) of the tests. You can run it through the tests with one of ./tests.d or dmd -i -run tests.d pqmarkup_lite.d I welcome anyone else taking the D and improving on it.
Jun 09