10 ms·
I'm a little unclear on whether this just produces programs that leak memory when using the C target. Are there any samples of what the generated code looks li
by etaioinshrdlu 5y ago
I'm a little unclear on whether this just produces programs that leak memory when using the C target.
Are there any samples of what the generated code looks like in various languages?
I would also like to suggest a project name change as soon as possible.
- geenew 5y ago'see programming language' would be more searchable, and would illustrate one use-case for the project (write some code, see what it looks like in a bunch of C-esque languages). Also, you could make jokes about the holy see programming language.
- etaioinshrdlu 5y agoHoly see would get confused with HolyC tho: https://rosettacode.org/wiki/Category:HolyC https://rosettacode.org/wiki/Category:HolyC
- geenew 5y agoI'm suggesting that just 'see programming language' be the name, but references to it as the holy see could cause confusion. Something like the great schism of programming languages :)
- goldenkey 5y agoRIP Terry Davis. What a titan among men. He belongs up there with the likes of John Carmack.
- goldenkey 5y agoIt's really sad he's gone, TempleOS was such a cool 64-bit operating system. It's unfortunate he got bullied so much that it ended up taking him away from us. People can be so mean :-(
- goldenkey 5y agoRIP Terry, you will be missed! TempleOS is the tombstone you rest under. :-)
- goldenkey 5y agoTerry, I miss you. May you forever be immortalized in the amazing legacy of TempleOS and Holy C that you left behind. Ticketmaster, screw you for not appreciating the smartest programmer in the world. There is a special place in hell for TicketMaster! While Terry resides next to the Lord himself!
- MonkeyClub 5y agoThe Wiki had solved it using "Cee": https://wiki.c2.com/?CeeLanguage https://wiki.c2.com/?CeeLanguage
- slimsag 5y agoFrom the author on an issue: > cito has no own garbage collector. You get what the target language offers. If it's C#, Java, JavaScript, Python, then there is a GC. In C, C++ and Swift, there are stack variables and reference counting for dynamic allocations. In OpenCL there are only stack variables.
- injidup 5y agoSo circular references when targetting C and C++ leak memory yes?
- pfusik 5y agoYes, you can make a memory leak when targetting C, C++ and Swift. Same as when you code in C, C++ and Swift directly.
- ethomson 5y agoRight, but when you write C, C++ and Swift directly you can also make a program that _doesn't_ leak memory. The question posed was whether that's even possible in Ć?
- yeputons 5y agoYes: Ć has "dynamic references" (`shared_ptr`) denoted as `T#`, "read-only references" (`const T*`) denoted as `T`, "read-write references" (`T*`) denoted as `T!` and "storage" (`T`) denoted as `T()`. So you can (and probably should) do almost any memory management as you would in C++. Except I don't see any alternative for `weak_ptr` at the moment.
- Calavar 5y ago> So you can (and probably should) do almost any memory management as you would in C++ Well that's already out the door because I almost never use shared_ptr in C++ code. The C++ core guidelines recommend using unique_ptr whenever possible. If you're going to use shared_ptr literally everywhere you do dynamic allocation, you'd be better off using a tracing GC to avoid the extra pointer indirection (and cache miss) with every dereference. It seems to me that Cito should have manual memory management because a manual memory language can be trivially mapped onto a GC language (just turn every free or delete to an nop), while the inverse problem is intractable in the general case.
- selfhoster11 5y agoAs a fellow Polish coder, I find the name extremely amusing. I don't know why the accent should be a problem.
- stjohnswarts 5y agoBecause most of us will have to go on the hunt to find the keystrokes to get the symbol.
- jhgb 5y agoHave you tried the APL keyboard?
- SAI_Peregrinus 5y agoRight-Ctrl C ' if you have a compose key (built in on Linux, WinCompose[1] for Windows, no clue for Mac). [1] https://github.com/samhocevar/wincompose https://github.com/samhocevar/wincompose
- remram 5y agoThat gives me a Ç edit: Looks like it's supposed to work, I don't know what I'm doing wrong: https://help.ubuntu.com/community/GtkComposeTable https://help.ubuntu.com/community/GtkComposeTable
- pasquinelli 5y agowhat do you get using comma?
- remram 5y agoThe same thing, ç edit: hold on, that's only in Firefox. Anywhere else, comma+c does ç and apostrophe+c does ć
- Lammy 5y agoAre you in en_US? The sequence you mentioned should definitely work in that locale. Here’s a more authoritative link than the manually-updated wiki page: https://gitlab.freedesktop.org/xorg/lib/libx11/-/blob/master/nls/en_US.UTF-8/Compose.pre https://gitlab.freedesktop.org/xorg/lib/libx11/-/blob/master... If you’re not in en_US you can find other locales and their Compose sequences in the nls directory.
- sodapopcan 5y agoI actually tried to wipe the accent off my screen a couple of times, haha. I dunno, this feels like it could be neat but agreed with everything in your comment.
- johnisgood 5y agoAt first I read it as: "C Programming Language" and "C programming language. Translated automatically to C", I was like... what? The main reason I actually clicked on comments is because I thought it was related to the actual C. The name is very confusing.
- johnisgood 5y agoJust to add: I did not see the accent because the font is too small. It is barely visible on, say, Á, too.
- benibela 5y agoI did not see it either Even though I put HN at 120% font size At least the github page heading has a large enough font size to see it
- pindab0ter 5y agoThere are more languages and ways of using the Latin script than just English. Many languages use diacritics.
- sodapopcan 5y agoI'm very aware of that. But because my mind interpreted it as the incredibly well-known and ubiquitous "C Programming Language", and that my screen often has little hairs on it, it was a natural reaction. I actually do think the name is quite clever, but very prone to confusion.
- yeputons 5y agoThey do leak memory sometimes. Cito frees variables, but not temporary values. It also has no chance of knowing whether a third-party function takes ownership of an object or not. The simplest example is string interpolation, I've just submitted an issue: https://github.com/pfusik/cito/issues/26 https://github.com/pfusik/cito/issues/26
- yeputons 5y agoTo be fair, the line between "Cito does not frees temporary values" and "the programmer screwed up by using wrong kind of references" is a little blurry. Most of my code in the issue above can be attributed to me writing dangerous code and getting shot in the foot, not Cito's issues. However, I don't think a project may simultaneously have dangling references and claim to follow "Principle of least astonishment". Dangling references are unsurprising if you've been using C++ a lot, but I expect them to be very surprising to people coming from basically any garbage-collected language: Java/C#/Kotlin/JavaScript.
- pfusik 5y agoI do not expect anyone to code a C or C++ library with no awareness of memory errors. This isn't a safe language on top of C++. If you target C++, you need to know it. On the other hand, if you only know "safe" languages and target "safe" languages, there will be no dangling references. By POLA, Ć doesn't reinvent keywords (compare to Rust) and the translated code is meant to look "obvious" compared to what you wrote in Ć. It's not "knowledge of C# is sufficient to write code correct in eight other languages" (that would be quite astonishing actually).