digitalmars.D - loci, a C++/D hybrid?
- "Ola Fosheim =?UTF-8?B?R3LDuHN0YWQi?= (7/7) Feb 21 2015 I wasn't aware of the language Loci:
- Kagamin (9/9) Feb 21 2015 ---
- FG (5/14) Feb 21 2015 Yeah, everything was fine, but when I got to this part, I almost fell of...
- "Ola Fosheim =?UTF-8?B?R3LDuHN0YWQi?= (5/7) Feb 21 2015 Heh, well there are some weird things in there, like having
- Kagamin (2/2) Feb 21 2015 Though, it looks like they have an approach to GC and manual
- ponce (8/15) Feb 21 2015 The most striking difference from D and C++ seems to be that
- "Ola Fosheim =?UTF-8?B?R3LDuHN0YWQi?= (6/12) Feb 21 2015 Yep, he is using fat pointers with hashing.
- ketmar (3/13) Feb 21 2015 c++ template syntax... this alone is enough to run away screaming and=20
I wasn't aware of the language Loci: http://loci-lang.org/ It looks like a mix of C++/D and some other languages. The docs gives D credit several places too. I think perhaps loci is too close to C++ to gain traction, but who knows? It looks like a fairly clean language from the docs alone, but I haven't actually tried it.
Feb 21 2015
--- void (*f)(); // C void (*)() f; // Loci int (*f)(); // C int (*)() f; // Loci int (*f)(int, int); // C *(int)(int, int) f; // Loci --- Ehh? Why the last declaration is so different?
Feb 21 2015
On 2015-02-21 at 11:51, Kagamin wrote:--- void (*f)(); // C void (*)() f; // Loci int (*f)(); // C int (*)() f; // Loci int (*f)(int, int); // C *(int)(int, int) f; // Loci --- Ehh? Why the last declaration is so different?Yeah, everything was fine, but when I got to this part, I almost fell off my chair. What the hell?! I hope it is just a bug in the documentation. Other than that, the documentation looks quite nice, except for the angle braces, or this eyesore: lval<const int> value_lval<const int> i = lval<const int>(value_lval<const int>(0)); Moving on, I'm a bit baffled by what their default string type is - http://loci-lang.org/Strings.html - and if it is worth the trouble and complexity, when compared D's default (linear & immutable + cost-less slicing). The most interesting part is that they don't use mangling and function overloading but instead have templates and this: http://loci-lang.org/TemplateGenerators.html to not have to instantiate for every permutation of types encountered. Indeed, it can help make stable APIs, but we'll have to see if it can be optimized to achieve performance. Well, gonna check again how things turn out for Loci in a couple of years.
Feb 21 2015
On Saturday, 21 February 2015 at 16:19:44 UTC, FG wrote:Yeah, everything was fine, but when I got to this part, I almost fell off my chair. What the hell?! I hope it is just aHeh, well there are some weird things in there, like having "self" as an alias for "*this"... but I have to say this is quite nice considering the author finished his undergraduate degree in 2012. I think he has a nice base to evolve from.
Feb 21 2015
Though, it looks like they have an approach to GC and manual memory management: http://loci-lang.org/GarbageCollection.html
Feb 21 2015
On Saturday, 21 February 2015 at 08:47:43 UTC, Ola Fosheim Grøstad wrote:I wasn't aware of the language Loci: http://loci-lang.org/ It looks like a mix of C++/D and some other languages. The docs gives D credit several places too. I think perhaps loci is too close to C++ to gain traction, but who knows? It looks like a fairly clean language from the docs alone, but I haven't actually tried it.The most striking difference from D and C++ seems to be that templates generates polymorphic code that works for all types. IIRC it is called "parametric polymorphism" whereas the C++-way would be "ad-hoc polymorphism". This has a runtime cost and is usually done by FP languages like Ocaml/Haskell.
Feb 21 2015
On Saturday, 21 February 2015 at 11:37:57 UTC, ponce wrote:The most striking difference from D and C++ seems to be that templates generates polymorphic code that works for all types. IIRC it is called "parametric polymorphism" whereas the C++-way would be "ad-hoc polymorphism". This has a runtime cost and is usually done by FP languages like Ocaml/Haskell.Yep, he is using fat pointers with hashing. https://github.com/scross99/locic/issues/1 I suppose a compiler could improve on that with whole program optimization? The nice thing about this is that you can add polymorphism to existing C libraries if I get Loci right.
Feb 21 2015
On Sat, 21 Feb 2015 08:47:41 +0000, Ola Fosheim Gr=C3=B8stad wrote:I wasn't aware of the language Loci: =20 http://loci-lang.org/ =20 It looks like a mix of C++/D and some other languages. The docs gives D credit several places too. =20 I think perhaps loci is too close to C++ to gain traction, but who knows? It looks like a fairly clean language from the docs alone, but I haven't actually tried it.c++ template syntax... this alone is enough to run away screaming and=20 forget that i ever seen your link.=
Feb 21 2015