9 ms·
I've been designing a language since 2009 – friends and I implemented a beta
- levodelellis 4y agoWhenever my compiler comes up the first question tends to be why? I found that everyones "why" are specific. Some people want to know how many libraries exist, others want to know specifically how many high level (or low level) libraries there are for easy of use (or performance). Some want to know what's unique others want to know the goals. It's hard to know what people want so I'll do my best on answering questions
- duped 4y agoHow do you achieve automatic memory management without GC (including ARC)?
- levodelellis 4y agoWould you accept a short answer? The 'short' answer is the compiler tracks various things such as memory owner (for alloc) and lifetime (for constructors/destructors). The compiler enforces rules so it's clear (to the compiler) if the memory owner belongs to the caller function (for example ReadEntireFile), the parent function (itoa causes the calling function to pass in a hidden buffer for it to use) and if it's on the stack, heap or belongs to an object (class struct or array)
- duped 4y agoSo does that forbid mutually recursive functions, threading, and self referential data structures?
- levodelellis 4y agoYes self referential data structures are forbidden. No threading at the moment.
- alexisread 4y agoDoes this lang have an explicit effects system? Does the memory management work similar to PerceusRC in Koka, or is it more similar to ASAP?
- levodelellis 4y agoI'm not familiar with those
- exysle 4y agoCould you go into more detail? I am quit interested and would love to learn more.
- levodelellis 4y agoI'm not sure what details you want. The easy one to explain is itoa. Since 64bit ints can be at most 20 digits the function returns a fixed length array. Currently it's u8[21] because I've wanted an extra byte for null (for testing before I had print implemented). I'm not sure if I'll keep the extra byte, anyway since 21 bytes fits on the stack the caller function will allocate it on the stack so it doesn't need to copy it. But it doesn't have to be on the stack, if you write `obj.data = itoa(anInt)` the compiler will pass `obj.data` in. If it's a local variable then the compiler would have to decide if it should be on the stack or heap. Passing in a buffer gets rid of useless copies for the case where optimizers can't inline the function.
- necubi 4y agoI guess the broader question is how do you achieve automatic memory management without something like Automatic Reference Counting (like swift), the ownership/lifetime systems from rust, or the generic effect system of Pony? Ergonomically solving this problem is a major research area, so if you’ve found a solution to it’d be worth presenting that front and center.
- exysle 4y agoYes, I would like to emphasize the last point.
- levodelellis 4y agoAre you saying I should write a paper? I'm not sure how much it would help when a lot of it is intricate to the design of the language. I have no idea what the page limit of papers are and what the point would be besides for fun. I never had fun writing a paper either
- 4y ago
- stefanos82 4y agoLooks interesting. Personally I would have simplified its syntax a little bit more, if possible. For instance, the following example code main() { sum := 0 for v in [5, 7, 11] index i //index is optional { if v == 11 { break } sum += v if sum > 20 { break } print("$i: $v") } _OnBreak { //<-- must be immediately after loop print("Index $i broke out of loop") } _OnComplete { //<-- Will not execute on break print("Array is OK") } } would have wrote it as follows: main() { sum := 0 for v in [5, 7, 11] index i //index is optional { break if v == 11 sum += v break if sum > 20 print("$i: $v") } _OnBreak :: print("Index $i broke out of loop") //<-- must be immediately after loop _OnComplete :: print("Array is OK") //<-- Will not execute on break } I honestly like simple, well-written code that is easy to follow.
- kleiba 4y agoDe gustibus non est disputandum - I like the original version much better than your proposal.
- levodelellis 4y agoFunny that you wrote `break if v == 11`. In a prototype I wrote 5 years ago (to learn syntax handling) I implemented this. What ended up happening is if I could do `break if ...` then I'd wanted to do expr if. Like `fn() if v == 1`. But at that point it gets confusing to read. Maybe I can try implementing this only for `break`, `continue` and `return` but it might annoy people because expressions aren't allowed. If expressions are then it's back to the problem I had in the prototype I don't know if it'll make things more clear to you but curlys aren't nessicary when you use return/break/continue. I didn't write it because I didn't want to scare people off with the lack of curlys or confuse people on the front page The `::` part looks nice. Would you want the statement to be forced on the same line? Or not like how C allows statements after `else`? As mentioned the compiler forces curly braces so it'll have to be forced to be on the same line as the on statement and I don't know if you'll find that to be a dealbreaker
- jstanley 4y ago
- Tao3300 4y agoA colleague and I used to talk about features we would throw into some hypothetical language. They were mostly really bad ideas that would have made INTERCAL look elegant, but it was fun to dream. Kudos to you for turning your own programming language dreams into a reality!
- levodelellis 4y agoThank you
- andsoitis 4y ago> Has features not found in any other language Do you have a list of those features?
- levodelellis 4y agoI won't speak for teammates but I found everytime I list features people don't really think about it. Maybe it's because they never seen it so they never thought about it and as a consequence don't think it's noteworthy. If you browse through the pages and read the examples you'll see many. The On statements for loops are my favorite and elsewhere someone told me they have no idea why I would want to know if a loop is complete (meaning you didn't break or return out of it) or why I would want a special handler for when you break a loop.
- lozenge 4y ago"Can you give a reason I would spend the time of looking through the docs?" "If you look through the docs you'll find many reasons"
- levodelellis 4y agoThe first sentence explains why. You don't need to be a jerk
- lozenge 4y agoIf you know that answering the question will make people lose interest then that suggests they will lose interest even after reading the docs as well.
- b3morales 4y ago> If you browse through the pages and read the examples you'll see many Respectfully, I browsed all the examples I could find on the site (Highlights, Examples, and Quick Start) and I'm not really sure what you expect to be recognized as novel ("Has features not found in any other language"). You may have a combination of features that is unique, but nothing individually stood out as something never seen before. Perhaps you just need to highlight these things better.
- thegeomaster 4y agoI'm not going to give out my email address in order to try out your language, sorry. Your EULA is a big turn-off as well. In this day and age, with so many niche programming languages popping up, I think it's going to be hard to gain a following with a proprietary compiler that you have to sign up to even download. More to the point, I think your site could do a much better job on describing what's actually unique about this. For example, I'm not convinced that the `_OnBreak`/`_OnComplete`/`_OnEmpty` machinery is useful enough to be part of a language. A bigger example where these features come in handy would be helpful to understand them. Just skimming the highlights and examples page, it looks very similar to C++. So I think it could use some side-by-side examples to show how it makes ordinary programming easier/more readable/etc. The Quick Start guide is a bit obtuse and feels incomplete. I'm having trouble understanding some features, and I feel the standard library is underdocumented---for example, I couldn't find what `.WSNL()` does, and it's used for your MIME type parsing example. I apologize if I'm sounding a bit harsh; I'm trying to provide some constructive criticism here. I appreciate how hard it is to get something out the door and I wish you the best of luck.
- levodelellis 4y agoI'll explain why there's a EULA and write another comment for the rest At the point that it was clear we're going to have a usable compiler I asked my entire team what license we should release this under. Absolutely everyone had a problem with each and every open source license. The more we talk the more apparent that none of us wanted to wake up one day to find out a trillion dollar (possibly cloud related) company took our code and want to compete with us. We don't want embrace, extend, and extinguish to happen to this project if we could help it. So we settled on a EULA (which very likely will change at 1.0) that says you can learn for free which lets face it, is the only thing people would want to do in its present state
- bogota 4y agoI get where your coming from but do you have an example of this happening for a programming language? I can’t think of any language that a company tried to extend and was successful with it. Its not a SaaS offering so the value add is very low for a company to try and take over development.
- marsven_422 4y ago
- mikewarot 4y agoI love the idea of changing the syntax around for loops, I just wonder if there was a cleaner way to do all of it, like optional parameters I think it would be hard to avoid a lisp-like {{{ hell though
- 0xcoffee 4y agoSeems like the same thing could be achieved cleanly with chainable results. My quick & dirty c# example. For.Loop(10, (i, @break) => { Console.WriteLine(i); @break(); }) .OnComplete((i) => Console.WriteLine("Done")) .OnBreak((i) => Console.WriteLine("Break"));
- levodelellis 4y agoA friend suggested this to me! I felt having `.` on a loop would be weird because it isn't working on an object A few people said they want single statements on conditionals. If `=>` (or `::` as someone else suggested) forced the statement to be on the same line would you be fine? I can imagine people wanting to use it on it's own line like people use else without braces which leads to bugs
- ModernMech 4y agoCurious if you have any blogs on your experience with the development process over the past 13 years. How was that time spent, what did you find most challenging, and what did you learn in the process? Is the website and forum written in your language?
- levodelellis 4y agoMultiple times there are several months without me considering or refining a feature. Development was less than that. I wouldn't know what people want to know about. In real life with friends and coworkers don't really want to hear about details or why I designed something
- levodelellis 4y ago> Is the website and forum written in your language? I forgot to answer this. It isn't but that'd be a good milestone.
- abrax3141 4y agoYou might consider, instead of creating a new language, providing a set of macros that expand the syntax of a well developed language that has a macro preprocessor. (It’s almost literally trivial in Lisp.)
- kmod 4y agoFyi "this language has been under design for a long time" is not always perceived as a good thing since it can be associated with navel gazing. IMO I'd advertise the language based on the core benefit you think it provides
- subjectsigma 4y agoIt looks nearly identical to Go. Am I missing something?
- yowlingcat 4y agoWhy write a new language rather than expand on an existing one or an existing ecosystem? Maybe I'm not the intended audience, but personally, I struggle to think of any reasons to use a new language except to get access to an ecosystem of packages I wouldn't be able to use otherwise. Something like TypeScript, for example, really caught my attention because of how well it integrated into the existing JS ecosystem, adding sanity while still not sacrificing interoperability.
- 6510 4y agoLooks nice. All these choices you have to make had me wonder: we've made formatting entirely part of a language but it seems a lot of it could be moved into the editor. Does it really matter if: if(foo==bar){{/*do something*/}} if foo==bar (/*do something*/) <if foo==bar>/*do something*/</if> foo&bar && /*do something*/ {if:foo==bar, do:/*do something*/, oncomplete:a(), break:b()} It could just be whatever the user chose in their editor (with an option to publish their custom solution) The code in the actual file can be any of the existing languages which would put some limitations on the formatting choices but if that gets annoying it could be addressed at many levels. Does this sound fun or should we pretend no one ever mentioned it?
- levodelellis 4y agoSounds like it would confusing to read due to inconsistent styles. A few people write transpilers for fun to change syntax of simple languages so it's not an uncommon thought
- al2o3cr 4y agoCouple thoughts/questions in no particular order: --- If arrays are passed by reference, how does the bounds-checking code deal with aliasing? For instance (apologies if this syntax is wrong): munge_arrays(int n, int[] a, int[] b) { if (n < 0) || (n >= b.size) return a.Pop() return b[n] } // good callsite first_array := [1,2,3] second_array := [4,5,6] munge_arrays(1, first_array, second_array) // callsite target := [1,2,3,4] result = munge_arrays(target.size-1, target, target) The "Array Bounds" section on the "Highlights" page suggests that the compiler will try to spot indexing errors (like accessing target[target.size]), but thanks to aliasing b can change size "at a distance" if the right parameters are passed to munge_arrays. --- What are the scoping rules for enum and bitflag names? The page in the Quick Start is unclear - sometimes they are qualified with the type name (Fruit.Apple) but not always (Banana, Dir farther down). Is this like Haskell records where every name has to be globally-unique? --- Similar question for "extend" - the last couple lines of the "Struct and Class" page hint at a feature, but it's unclear what the scope of extension is. Is that based on the type of the first argument of the function being extended (Test in this case)? --- One more scoping question: what names are in scope in an _OnBreak clause? For instance, in the nested part of the "LoopsWithExits" example, can that inner _OnBreak see v2? --- How does constructing an instance of a class with arguments work (if at all)? The examples of constructor() functions are all arity zero, is the intent that an instance be constructed "blank" and then subsequently mutated? --- One feature notably absent from the examples is passing functions as parameters. For instance, is it possible to write a "mapIntArray" function that takes an "int[]" and a function (that takes an int and returns an int) then returns the result of applying the function to each element of the array? --- Has features not found in any other language IMO you should either list them, or change the marketing language. I'd recommend the latter - people don't pick languages because they have unique features, they pick them because they NEED what the unique features help them accomplish. What's some code that Bolin makes easier/clearer/safer/whatever to write? --- (e) Licensee shall not publish or disclose to any third party the results of any benchmark tests or other evaluation run on the Software without the prior written consent of DeLellis. Is this 1994? Did I accidentally click on a link to Oracle.com? If I downloaded the software and did some experiments to answer my own questions above, would I have to ask for PERMISSION to post the results? You want "the community" to contribute feedback and ideas for free, but you want to retain absolute control over both the software and the conversation. That's not a good trade.
- pmarreck 4y agomy first impression is that breaks are less than ideal for flow control, it's like using runtime error handling for flow control