-
Notifications
You must be signed in to change notification settings - Fork 156
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
So-called "next big version" #811
Comments
Good idea, let's at least get everything down on a list. |
Types are neat.. but does that mean there will be ++ es6 modules, const, match, it |
In high priority ES features, which don't have analog in LS: modules, iterators, ... I think LS should be compile in ES with time. At the beginning it may compiled in two modes:
In new mode fat arrow, default params, spreads, destructing, e. t. c. compiled as is in ES. Later, when browsers allow, compile only in ES without flag. LS classes better than ES now, because it have private members (without binding context) and class props. But if this features accepted in ES, LS should be compile classes in ES. Variable declaration mechanism awesome in LS, I think it don't touch. Each of removed features from LS should have own issue discussion. |
What about |
We have an issue and a branch for that |
I know it. I mean that in this list / next big version. |
I think |
Agree with:
I prefer to use |
Implicit variable declaration in LS isn't as awful as in e.g. CoffeeScript where merely adding a global variable may change the behaviour of code elsewhere. But I agree that full lexical scope (not function scope) and explicit declarations improve code legibility. It makes it clear when exactly a variable starts being in scope; small tokens like |
And it's a main reason why I hate CS! It's awful, it will penetrate your ass with a lot of pain when you don't expect it. You have file with 200 lines for example and you declare variable in 50 line, and in 150 inside some P.S. In LS you definitely sure that you won't change value out scope if you don't really want it with specific operator |
I like too |
Happened to read this as I was preparing to create an issue. I'm using it. Is there something wrong with class Game implements EventEmitter:: |
I completely agree. I might be biased in favor of flow, but that's precisely because of the same reason that I prefer LS instead of JS. Both flow and LS come from a more functional mindset. |
The syntax differences between Flow and TS are very minor and Flow reads TS definition files natively.
I wonder if the flow praising people here actually used flow? |
... On the other hand, TS' type system is unsound. |
Flow has |
@igl Yes, but it never infers it. |
I agree with @copygirl on Can anyone elaborate on why |
@summivox because metaprogramming, mostly |
👍 keeping |
@vendethiel how about a banged version |
What is the benefit of compiling to ES6 classes? As far as I am aware they do not provide any unique functionality. OTOH I think you have to if you want to support Flow or TS. |
Hm, LS had operator overloading? @igl Flow has better type inference, and uses occurrence typing, so types for most idiomatic functions in JS are very natural in Flow, and impossible to write in TypeScript. And TS's type system is unsound wrt subtyping + parametric types, so even if your program type checks, it might still throw errors at runtime, Flow's type system is sound, so if it something passes the type checker, you're guaranteed that you'll get that behaviour at runtime. @summivox ES2015 classes are sort-of a very stripped down version of LS classes (they have similar runtime semantics, but ES2015 classes are designed to be static declarations, which really makes them less useful than they could be), you don't really gain anything by compiling to them. |
@robotlolita some operators behave specially when passed literals. Like with all special cases, this hinders refactoring.
|
I guess I dhould say "overloaded operators" |
I'm working on reform for operator spreading; discussion at #831. The upshot is to remove support for existing ‘implicit’ unary operator spreading over lists (because does
I have a proof-of-concept demonstrating that the parser only needs small changes to support this. |
_Warning: long comment._ TL;DR: (probably the longest TL;DR ever known to man 😄)
Out of all of these, the only things holding me back from using LS for almost everything is My 2 dollars for all this (little more than 2 cents here 😄):
|
I agree that ES6
👎
|
I'm on my phone, so not gonna answer everything right now, but in the case of types, no, LS should not call them itself. It makes no sense. |
Gradual types are asbestos. |
One more for the pile: is this feature worth keeping? (f and g) x # compiles to f(x) && g(x) It's always struck me as very ad-hoc.
|
@rhendric |
Fair enough—I hadn't generalized ‘operators that behave differently when used on certain literals’ to ‘operators that behave differently when used in certain syntactic constructions’, but it's clearly related. Possible that the decision to keep/remove would not be uniform across that entire class, though—each case has its own implementation to maintain, after all—so it might be worth enumerating somewhere all the cases under discussion. |
In this case, it was (mostly) created for match |
That makes sense; outside the context of a match pattern, though, perhaps it should either revert to the default operator behavior, or behave more like other overloaded operators (in that they require operand syntax trees that would be useless otherwise to trigger the special behavior)? For the latter route, I'd specifically propose as the trigger requirement that both operands are function expressions of some sort—it would admittedly be pretty cool to be able to say first-quadrant-points = filter (.x >= 0) && (.y >= 0) Lifting the |
I'd prefer more code (e.g. |
Yeah, let's not add literal overloading anymore :) |
I agree with literal overloading. In my experience, it's a better obfuscation tool than anything useful in most cases. And the gotcha/inconsistency with the dot operator ( |
I'd like getting people's opinions on #863. |
I would like to add to that grand list making some of the unusual edge cases that should never parse as explicit errors instead of weird behavior or compiler runtime errors. Things like |
Have you thought of making classes this way in LiveScript? # Initial
class Foo extends Array
->
super ...
@prop = 1
foo: -> 1
bar:~
-> @prop + 1
(value) !-> @prop = value - 1 // Compiled ES6
function defineMethods$(C, Super, props) {
C.prototype = Object.create(Super.prototype);
for (var prop in props) {
var desc = Object.getOwnPropertyDescriptor(props, prop);
if (desc) { // own property
desc.enumerable = false;
Object.defineProperty(C, props, desc);
}
}
}
let Foo = (Super => {
function Foo(...args) {
// Note that `this` must be aliased.
let this$ = Reflect.construct(Super, new.target, args);
this$.prop = 1;
return this$;
}
defineMethods$(Foo, Array, {
foo() { return 1 },
get bar() { return this.prop + 1 },
set bar(value) { this.prop = value - 1 }
});
return Foo;
})(Array); |
I like |
@vendethiel WDYT about my solution to the class problem above? |
Not sure why you'd want this kind of solution, tbh. We can probably compile the method names we know at compile-time into a real ES6 class |
Good point. So, in other words, it'll be a combination of The rationale for my idea was that you could both call and construct it for similar effect (unless you decide to include I'm not as invested in LiveScript as I used to be, between the incorrect mappings (too busy to track them down) with It doesn't help my energy that, for the testing framework I'm currently working on and putting most of my effort into, I've had to reimplement and drop about 2-3 different dependencies, and copy portions of other libraries. One made debugging a difficult bug even harder because of a dependency chain completely consisting of ~5 lines of code each. Another was 90% what I wanted, but it didn't have an option to fix the 10%. Mocha had about ~80 lines of code I needed, but I had to tweak them for a different code architecture. Since this is 3.7k LOC (7.4k for tests, mocks, etc.) pure ES5 JavaScript (I bailed from LiveScript early on because the stacks were wholly unhelpful at the time), I haven't done much with LiveScript, and generally haven't had the time. |
Any chance removing this feature could be added to the list? |
That one's bitten me before, too. It's annoying. By the way, what drove me away from LiveScript after really wanting to love it was all the little things:
None of these would've individually drive me away, but a buggy compiler and language inconsistencies like these among others are what would bring me back for 2.0. Yes, pattern matching is nice, but it's the thousand papercuts that killed it for me. |
For the first one I just do this - to make it more explicit obj1 = [
*id: 1
]
obj2 =
* id: 1
* id: 2 I know it could be better but I will wait for it when it updates. |
One think I think would make LiveScript really shine is the ability to create custom operators so for example with fantasy-land I would like to do hello = (x,y) --> x + y hello = _.curry (x,y) -> x + y instead of having livescript compile a curry function for every script. also for monads do
<- hello x
console.log 'foo' (hello x).bind (-> console.log 'foo') this gives a lot of flexibility and prevents a lot of arguments ( like human arguments not computer arguments ) - and also makes live-script flexible to changes from the rest of the javascript world. |
Sorry, that's not something I'm gonna work on on the foreseable future. If someone wants to take this list over and do something with it, best of luck to you & to the future of LS. |
I'm very interested in making this go forward, is there anyone else? |
mark |
LiveScript "2.0"
"It's a-boot time"
So, this got talked about quite about before, but I'm not sure that's actually what's interesting to us now.
However, there's definitely a need to cleanup some things in LS, and especially with ES6/7-related.
Are people okay with breaking changes now? If they're not, we can discuss what we want to change, but in the meantime:
import!
andexport!
for the ÈS6 modules (we need to decide between<<<{<,}
andimport {all,}
anyway)->**
)const
needs to be compiled to ES6'sconst
let
's meaning, I don't think it adds much.for ever
implements
(unless people actually use it)>==
etcmatch
an actual pattern matching operation (semantics TBD, that can come later)otherwise
/default
,case
/when
,=>
/then
(I guess this one is the one people like), etcThis will be controversial (at best), but I think it's worth discussing:
I believe we should remove implicit variable declaration. We have
var
, and:=
when we need to change a value.I think the scoping rules would seem much saner if we had to explicitly declare those. But I know this isn't going to fly for a lot of people, so...
There's another controversial topic:
..
,it
andthat
. I like what we currently have, but I'm too biased to know if that bugs people or not.The text was updated successfully, but these errors were encountered: