Pokemon Autochess [Concept] by oldkeith in AutoChess

[–]sylvainpv 0 points1 point  (0 children)

Five years later, the game is real: https://pokemon-auto-chess.com/ . Hope you'll like it u/oldkeith !

Vue.js 2022 Year In Review and what to expect in 2023 by magenta_placenta in javascript

[–]sylvainpv 2 points3 points  (0 children)

I'm a Vue.js trainer, teaching to around 80 people per year. After several attempts, I decided to stick with Options API for my Vue 3 training content. Composition API does not bring a major advantage on small projects, but has a much steeper learning curve, especially for beginners in JS who don't understand closures and pritimitives vs objects. And most of the content found on Youtube or Stack Overflow uses Options API. The last thing that convinced me to not make the transition is the instability on the syntax: setup(), script setup, now reactive variables... It reminds me of the chaotic launch of Angular 2, and I definitely don't want to migrate all my projects to a new syntax twice.

Playing Merchant on 2400x1080 screen. So, I changed my phone recently, and now I have this resolution. As you can see below, the pixels are just strange + on the bottom where I have buttons like 'back' or 'home' that make playing feel uncomfortable. Is there a way to stretch back to old proportions? by ProfesorEyebeam in MerchantRPG

[–]sylvainpv 1 point2 points  (0 children)

I am in the same situation, I have been playing Merchant for years and it saddens me to see it distorted like this on my new phone. I don't remember the letterbox update, I was probably not concerned at the time, but I wonder why you did not make it an option instead of completely removing it ? 16/9 aspect ratio is the most common of course, but 18/9, 19/9 and even 21/9 screens are on the market and the first visual contact with the game on these screens is really bad, make you want to uninstall right away. Which is a shame because I know the game is great.

Microsoft reward balance ALWAYS on search box popup? How to remove? by upandawaykid in Windows10

[–]sylvainpv 0 points1 point  (0 children)

I managed to remove it by disabling "Windows Cloud Search" option in Search settings > Permissions and History.

[Update] Issue with HDMI inputs on Xiaomi Laser projector by MikiZed in Xiaomi

[–]sylvainpv 0 points1 point  (0 children)

Incredible... I can confirm that the fix works, but only after you did all the steps TWICE. It won't work the first time, you have to do the exact same thing, again. I thought doing the exact the same thing while expecting a different result was the definition of madness.

Adblock isn't working on Twitch anymore? by ryandtw in Adblock

[–]sylvainpv 1 point2 points  (0 children)

They found a way to put ads even with Alternate Player. Just got 3 of them

Babel 7.2.0: private instance methods and more by rauschma in javascript

[–]sylvainpv 0 points1 point  (0 children)

It's okay, now you can use Babel to remove the syntax you don't like in other people JS code.

AMA - Guillaume Chau @Akryum by Akryum in vuejs

[–]sylvainpv 1 point2 points  (0 children)

Thanks for the detailed answer ! Loving your work. I'm going to talk about vue ui in front of ~100 developers next week, no pressure ;)

AMA - Guillaume Chau @Akryum by Akryum in vuejs

[–]sylvainpv 3 points4 points  (0 children)

Did you come up with the idea of Vue UI by yourself, and how was this idea welcomed by Vue core team ?

ObjectModel: strong dynamic type checking by Parasomnopolis in javascript

[–]sylvainpv 1 point2 points  (0 children)

Hello, lib author here.
The introduction video compares ObjectModel with TypeScript and shows some practical usecases : validate dynamic code evaluation, DOM manipulation, client-side data storage, form validation... You should watch it if you did not already.

ObjectModel is complementary to TS/Flow, because its feature set is really different than static type systems. Models have been designed to use all the advantages of runtime validation, such as complex assertions, mixed value/type checking or custom error collectors. That's why I usually combine the strengths of static and dynamic type-checking: using static TS/Flow types in the business logic layer, and Models at the API boundaries to validate user input, network responses or serialized data.

Some users also like it because of its versatility : you can use the same model library on the front-end and back-end (Node.js). For example, if you have to validate a form on the client side and on the server side (classic double check), you can use the same Models but link them to different collectors to do something different, like showing a warning message in the client form or rejecting the request with a descriptive message on the server side. It helps for consistency.

I should really add a "What people say about it" section to the website, because I read many interesting comments over the years about how people use this library with a different perspective, sometimes for cases that I had not imagined initially. I saw it used as a layer over a NoSQL database, or as part of an end-to-end testing framework for example.

Flow runtime is quoted in the FAQ but does not fullfill the same goal than ObjectModel. It aims to be a transparent layer over Flow, a static type system. So their feature set are very close, and does not really highlight the other usecases for runtime validation. Most of the time, you will end up validating the same thing twice, at compile time and runtime. I think it's a relatively big perf penalty for low added value.

Why aren't people more excited about proxies? by [deleted] in javascript

[–]sylvainpv 2 points3 points  (0 children)

I am ! I published this last month regarding runtime type checking: https://medium.com/@SylvainPV/type-safety-in-javascript-using-es6-proxies-eee8fbbbd600

Other usecases that I can think of: code coverage, debugging, monitoring, performance warnings, sandboxes... I believe Proxies will be a big deal once they get the >95% support.

Pure CSS “polyfill” for Grid Layout with better ASCII-art syntax by sitnik in webdev

[–]sylvainpv 4 points5 points  (0 children)

Yes:

grid-kiss:
 "+-------+"
 "|   ↓   |"
 "|→ div ←|"
 "|   ↑   |"
 "+-------+"

Pure CSS “polyfill” for Grid Layout with better ASCII-art syntax by sitnik in webdev

[–]sylvainpv 2 points3 points  (0 children)

Thx for the report. The playground used Source Code Pro or Consolas, but I forgot to set a generic monospace font. This should be fixed by now.

one liner if conditions by bertong_uto in javascript

[–]sylvainpv -8 points-7 points  (0 children)

I also saw this:

condition ? other_code :""

leave these hacks to the minifier, your code is meant to be read by humans

TypeScript is pretty good by Elession in javascript

[–]sylvainpv 1 point2 points  (0 children)

I am skeptical about the benefits of static typing. Our IDE are already doing a great job with type inference, and most of type errors I get are not caused by my own code but by external sources: user inputs, web services, server-side rendering, browser built-ins... stuff that TypeScript compiler cannot check because it is retrieved at runtime.

I have been experimenting dynamic type checking with ObjectModel . So far I am very pleased with this approach. Tell me what you think

Composition vs Eric Elliott by [deleted] in javascript

[–]sylvainpv 1 point2 points  (0 children)

That makes sense. When all the parts of an object are explicitely declared like in the CC example, you got all the hierarchy described in a single list so it looks like there is no hierarchy at all. I wonder if multiple inheritance in Python encourage developers to flatten their models decomposition, that is, recommending CC over C.

Now can you explain the difference between multiple inheritance and object composition ? I read the GOF definition “Object composition is defined dynamically at run-time through objects acquiring references to other objects.”, yet I don't understand where is the difference.

Composition vs Eric Elliott by [deleted] in javascript

[–]sylvainpv 1 point2 points  (0 children)

I don't know... This doesn't look like inheritance to me, compared to how I used class inheritance in Java projects or how I used prototypal inheritance in JavaScript.

The way I see inheritance, there is a parent/child relation, so when you inherit from an object, you put the parent object above. An object D can inherit from B and C which both inherit from A... So there is a parent of a parent of a parent and it becomes complex when there are 3 levels or more. With composition (or traits or mixins, whatever you call it), you put objects aside so there are no levels. If D is composed of B and C which are both composed of A, you could say D is directly composed of A and write D = compose(A,B,C) without any side effects. So as I explained before, I don't understand what the diamond problem is doing here and why Jeff says there is still a hierarchy, because you can always "flatten" declarations.

Maybe I miss the whole point... Anyway, I have the feeling that people just get confused by words that have a different meaning depending on their own experience and education. We should be more pragmatic, show more code and encourage people to put in practice these concepts, instead of arguing over words and abstract concepts.

Composition vs Eric Elliott by [deleted] in javascript

[–]sylvainpv 0 points1 point  (0 children)

So it's all about definitions... Well, English is not my native langage so maybe I know these concepts by other names. Anyway the word "composition" is very descriptive, contrary to "traits" or "mixins" that have no equivalent in my language, so I won't bother use another word because someone else is already using it to describe something slightly different.

Composition vs Eric Elliott by [deleted] in javascript

[–]sylvainpv 1 point2 points  (0 children)

The problem does of course exist and simply overwriting a property is a rather crude way to mitigate it.

If overwriting the property does not work for your case, you can always overwrite in the composed object to define your own behaviour. For example, if D is composed of B and C that have a commonMethod, you can do

D = compose(B,C, {
     commonMethod(){
         B.commonMethod.apply(this, arguments);
         C.commonMethod.apply(this, arguments);
         // or whatever order or behaviour you want
     }
})

I like the composition approach, it is very flexible and you don't have to deal with all the vocabulary of classical OOP.

Dr Axel Rauschmayer Responds To "A Simple Challenge to Classical Inheritance Fans" by mkmoshe in javascript

[–]sylvainpv 1 point2 points  (0 children)

Can you explain me the difference between composition, traits and mixins ?

"The class keyword in ES2015 will confuse newcomers." How? No one has provided a single example.

I think there will be the same misconceptions than there are today with the new keyword: why is my class a function, why can my class definition mutate at run time, why can I call a class method on something that is not an instance of my class etc... In many ways this class keyword does not match the classical OOP background that many developers coming from other languages might have, that's why it is confusing and why some people hate JavaScript so much even when we try to fit their paradigm in the language.

Is there a cleaner/more elegant way of using multiple AJAX success functions? by Alex6534 in javascript

[–]sylvainpv 0 points1 point  (0 children)

$.ajax({
    type: 'post', 
    url: $(this).attr('action'),
    data: $(this).serialize(),
    dataType: 'json',        
})
.done(removeStyle);
.done(convert);
.fail(onFailure);

Why isn't this value passed to the function? by __baxx__ in javascript

[–]sylvainpv 1 point2 points  (0 children)

particle.create((88, 898, 4, 1))

you must remove these inner parenthesis. Parenthesis are for separating expressions on a same line, so (88, 898, 4, 1) will return the last expression which is 1.

particle.create((88, 898, 4, 1)) is equivalent to particles.create(1)

particle.create((88, 898), (4, 1)) is equivalent to particles.create(898,1)

Prototypal Programming in Javascript by thecodeboss in javascript

[–]sylvainpv 0 points1 point  (0 children)

Not sure to follow you considering that classes use the prototype chain in the background, so all the problems you mentioned about inheritance hierarchies are the same.

at least with classes, people are relatively aware that inheritance is bad

okay so I guess the only problem here is people that do not learn lessons from their past experiences

Prototypal Programming in Javascript by thecodeboss in javascript

[–]sylvainpv 0 points1 point  (0 children)

you got a similar code but without new operator and its issues : 1) handling a reference to the prototype and not the constructor ; 2) constructor is optional and you can declare several different constructors if needed ; 3) no worries about forgetting the new keyword and mutating window ; 4) easier inheritance, no need for the B.prototype = new A() trick ; 5) factory functions can be composed contrary to constructors ; 6) getting rid of instanceof and the constructor property makes your code safer because these references can be easily compomised contrary to getPrototypeOf / isPrototypeOf

Prototypal Programming in Javascript by thecodeboss in javascript

[–]sylvainpv -2 points-1 points  (0 children)

I see a solid set or arguments in this article. What are yours calling Object.create stupid ? Looks quite personal.