News for hackers. Stuff that matters.
Re:Lily Programming Language by S4M on Friday July 01, 2016 @09:43AM (#12015932)
Does it support operator overloading? I tried it quickly (`define +(...){...}`) but it didn't work. Maybe there is a notation for it but I couldn't find it in the tutorial.
Re:Lily Programming Language by jesserayadkins2 on Friday July 01, 2016 @09:47AM (#12015962)
There's no operator overloading. I'm pretty reluctant to add it too, because I've seen it be abused far, far too many times. It has uses, yes, but I'm not very interested in it at the moment.

I won't say absolutely no to it, but if it were to be added, it wouldn't be right now. There's too much api that needs doing right now.

Re:Lily Programming Language by hawski on Friday July 01, 2016 @10:29AM (#12016281)
I always dreamed of language without operator overloading, but with builtin vectors and matrices. Maybe they could be easily mapped to SIMD instructions. They can have a bit different operator (like in one PEP [1]).

I know that there are intrinsics for C, but they are non portable. Maybe except NaCl [2].

Also is concatenation of strings only done through usage of $"^(variable)" syntax?

[1] https://www.python.org/dev/peps/pep-0465/

[2] https://developer.chrome.com/native-client/reference/pnacl-c...

Re:Lily Programming Language by jesserayadkins2 on Friday July 01, 2016 @11:25AM (#12016849)
It's probably possible, especially with today's compilers being smarter about using those instructions. You're right, in that concat is currently only available through interpolation.

At the moment, I'm not interested in adding vectors or SIMD. It's something I might try further down the line, but not now.

Re:Lily Programming Language by S4M on Friday July 01, 2016 @09:57AM (#12016026)
That's a fair point but on the other hand I think operator overloading is a must to be able to program math formulas in a language. Do you plan to have something like `const` as well? If so, how about allowing operators, but only if they don't modify the object (though, that rules out stuff like+=).
Re:Lily Programming Language by jesserayadkins2 on Friday July 01, 2016 @10:16AM (#12016170)
Const is something that I'd like to think over before adding it. A question I have is what happens if a List is const, or should it just be that only primitives are const? I could see const values being optimized as just literals down under the hood, which would be nice for performance.

I'd have to have a long, long think before adding operator overloading. It's got uses for math, but thus far I've been reluctant to add features that can be abused or used improperly like native class dtors or finally.

Re:Lily Programming Language by marktangotango on Friday July 01, 2016 @09:26PM (#12020959)
Have you looked into the difference between c++ const and java final for an example of different semantics? Suffice it to say the two are very different. Not sure why anyone would be doing math code in an interpreted language, I guess if it where embedded in game engine that would be desirable, but then users may wrap c/c++ math libraries with swig-alike to use, using the ffi, whatever that turns out to be.
Re:Lily Programming Language by winstonewert on Friday July 01, 2016 @03:45PM (#12019132)
Can you give an example or two of abuse that you've seen?

I've seen the complaint that operater overloading allows abuse, but most the examples I've heard seem farfetched.