morganstanley / hobbes

A language and an embedded JIT compiler
http://hobbes.readthedocs.io/
Apache License 2.0
1.16k stars 105 forks source link

Proposal: rename source files #431

Closed data-man closed 2 years ago

data-man commented 2 years ago

Very interesting project, thank you!

Please rename: *.C -> *.cpp. *.H -> *.hpp.

These are non-standard extensions and incompatible with many case-sensitive tools!

smunix commented 2 years ago

Can you elaborate a little more? What tool are you having issues with? What do you use Hobbes for?

data-man commented 2 years ago

E.g. ksnip_20211024-010057 It's confusing.

What tool are you having issues with?

E.g. mcedit (Midnight Commander file manager) doesn't apply C++ syntax colouring to these file extensions.

What do you use Hobbes for?

Just discovered Hobbes and exploring the sources. :)

smunix commented 2 years ago

I'm not sure what the standard file extensions for C++ are. Looking at the link below, this is mostly a business organization question than a technical one, so I'm not sure what the added value would be to change this now: https://isocpp.org/wiki/faq/coding-standards#src-file-ext

Also, it looks like this is configurable with mc. It might as well be addressed there directly? https://github.com/MidnightCommander/mc/blob/c8649068d30ef02277ab897c2b131736d24937af/misc/filehighlight.ini#L37

data-man commented 2 years ago

Also, it looks like this is configurable with mc.

Are you suggesting adjusting all tools due to a single project? :) Ok, I can provide a much longer list. E.g. tokei:

Language Files Lines Code Comments Blanks
C 112 48910 39660 2372 6878
C Header 121 39933 33361 2347 4225
CMake 2 151 124 2 25
Dockerfile 1 6 6 0 0
Happy 1 1046 883 0 163
Makefile 1 223 187 6 30
Nix 3 188 167 0 21
Python 2 1308 1231 49 28
ReStructuredText 19 2537 1576 0 961
Shell 3 46 27 6 13
Vim script 1 56 48 3 5
Markdown 8 1738 0 1344 394
C++ 1 260 192 27 41
(Total) 1998 192 1371 435
Total 274 96142 77270 6129 12743
smunix commented 2 years ago

I never suggested changing all tools, no. I was merely suggesting a workaround for your use with mc, if you can afford to do so. I believe none of these filename extensions are uniformly superior to any other ones, and would like to see what value the proposal to change these files extensions adds to Hobbes. If you can articulate around that point, I'd be happy to see what we can do to improve the situation.

data-man commented 2 years ago

https://isocpp.org/wiki/faq/coding-standards#hdr-file-ext Q: What header-file-name convention is best? foo.H? foo.hh? foo.hpp? A: If you already have a convention, use it. If not, and if you don’t need your editor to distinguish between C and C++ files, simply use .h. Otherwise use whatever the editor wants, such as .H, .hh, or .hpp. We’ve tended to use either .h or .hpp for our C++ header files.

smunix commented 2 years ago

fwiw, other Hobbes users are on .H and .C and use different tools. It would be nice to know how crippling the current extensions (our de-facto standard) are for them, as well as the impact of changing these extensions.

data-man commented 2 years ago

It would be nice to know how crippling the current extensions (our de-facto standard) are for them

Just enable GH Discussions in this repo and ask them. :)

smunix commented 2 years ago

@data-man - I'm a little curious to hear about your impressions of Hobbes, how you intend to use it and how you landed on it? Would you mind sharing?

data-man commented 2 years ago

@smunix

your impressions of Hobbes

I have no impressions because Hobbes is incompatible with LLVM 13 (at least).

how you intend to use it

Learning LLVM API and using knowledge for C3 language. :)

kthielen commented 2 years ago

If all you want to do is learn the LLVM API, why don't you just work through their Kaleidoscope example? https://llvm.org/docs/tutorial/MyFirstLanguageFrontend/index.html

LLVM frequently makes breaking changes for little benefit (sometimes even causing performance regressions), so if you're happy being on the upgrade treadmill then just going right to the source there is your shortest path.

HTH.

smunix commented 2 years ago

I believe we can reasonably close this. Feel free to re-open if you're still interested in this.