News for hackers. Stuff that matters.

zastrowm

The charitable view would be that they come from language/platform that does include the base-class's methods/apis.

Your example of dotnet/C# doesn't seem to be the best - DotNet/C# repeats the base documentation - for example the SaveFileDialog class [1] lists all of the methods but indicates when the methods come from the base class.

Flutter also seems to list inherited methods - for example the TextButton [2].

[1]: https://learn.microsoft.com/en-us/dotnet/api/system.windows....

[2]: https://api.flutter.dev/flutter/material/TextButton-class.ht...

I liked Edge originally too - it seemed cleaner than chrome and had some cool features like vertical tabs and the Dev tools that were better than Chrome's. I made it my daily driver.

Then they adding a shopping helper; then more ads to the new start-page; then a notification about Microsoft rewards; then popups about how "Bing is better" or that "Bing AI" was there to help - don't forget the "Open links in Edge on Mobile" popup; then they added a side toolbar with a giant B[ing] button that wasn't removable unless you toggled a group policy (now there's an option for it). The damn button was the last straw for me because of the amount of work I needed to do to just disable it.

> I just want to get on my computer - do a few things and get some stuff done

Yeah, so do I and Edge kept getting in the way to keep telling me about all the new things that Microsoft things I should use.

Chrome isn't great - the privacy sandbox/built-in interests stuff is disgusting - but Chrome wasn't as "in your face" so I could just start it and go. Brave avoided the the privacy sandbox and now Firefox works for me everywhere.

I find the best middle ground is setting up the IDE to have TSC watch running while making changes, but using other tools for doing the actual compiling (vite for example). This allows me to refactor quickly - choosing when to ignore type errors - but also be notified of all the other call sites that I need to update, including in all of the files not currently open in the editor.
It may not be the correct way or a smart way, but it is objective - the metric being used cannot be interpreted one way or another, it's just LOC.
Re:Not using useCallback is premature optimization on Wednesday August 17, 2022 @09:01PM (#32503904)
For this specific example the problem is that the handleClick callback is using a stale/cached onImageDeleted callback (which indirectly has old state). If you add onImageDeleted to the handleClick dependency array, it beings to work as you expect.
Re:The Deno Company on Monday March 29, 2021 @01:41PM (#26625445)
I think the point was that it's not different from Node.js - and thus not much of a benefit.

If it was more along the lines of "I want to use this array helper library, but it shouldn't have any permissions" then it would be a lot more useful, but right now if your Deno app needs any file or network access, then all of your dependencies get access too.

Re:How generics were added to .NET on Monday March 05, 2018 @07:51PM (#16525996)
Yeah, but I wonder if .NET wouldn't have succeeded until .NET Core without generics as a distinguishing feature. I feel like generics + some of the features built on them (LINQ+TPL+etc.) is what let .NET/C# stand apart from Java.

I'm not necessarily saying it would have failed, but I do wonder :: )

Re:How generics were added to .NET on Monday March 05, 2018 @06:38PM (#16525606)
This surprised me:

> It was only through the total dedication of Microsoft Research, Cambridge during 1998-2004, to doing a complete, high quality implementation in both the CLR (including NGEN, debugging, JIT, AppDomains, concurrent loading and many other aspects), and the C# compiler, that the project proceeded.

I didn't realize that it was less a "must-have" and more of a "research and if-possible" task. I wonder how the .NET framework/languages would have changed if they went with type erasure. Would we even still talking about .NET today?

Re:Mono and WebAssembly – Updates on Static Compilation on Tuesday January 16, 2018 @04:00PM (#16162520)
I crave this for C#/.NET; I was hoping the article was going to mention something about faster edit cycle w.r.t. normal apps. It came pretty close:

> ... uses the new Mono IL interpreter to run managed code at runtime... to be used for quickly reloading C# code and prototyping

So maybe it will/can provide the foundation for faster edit cycles with native apps and not just WASM.

Re:Mono and WebAssembly – Updates on Static Compilation on Tuesday January 16, 2018 @02:17PM (#16161276)
The CSharpLang github[1] repository would be where to look for this. I didn't find anything that mentioned adding language support for it, and IIRC, in the past they rejected the idea of inline XML or JSON support.

Going the other way of C# inside HTML, you have Razor[2] and Blazor[3], the latter of which is a prototype of Razor running in the browser via web assembly.

[1]: https://github.com/dotnet/csharplang [2]: https://docs.microsoft.com/en-us/aspnet/core/mvc/views/razor [3]: http://blog.stevensanderson.com/2017/11/05/blazor-on-mono/

Re:Takeaways from KotlinConf 2017 on Thursday January 11, 2018 @10:08PM (#16130106)
I'm curious if this will change now that webapps/electron-apps have become so popular. It may be that users have begun non-native apps as the new norm.
Re:Mitigations landing for new class of timing attack on Thursday January 04, 2018 @11:23AM (#16071543)
Has there ever been discussion about a permission for "running as an app" that would make a distinction between web pages and apps? I like that the web gets more features that allow apps to run cross-platform, but I don't fully understand why we make no distinction between pages and apps.
Re:Thoughts on Microsoft's Time-Travel Debugger on Monday October 09, 2017 @11:33AM (#15434689)
Yep, it's annoying to have those limitations, but I sort of understand why. They could make their message a lot clearer though.

> I personally would have the hardest time with the 250 user limit

From the document, the text is "more than 250 PCs or users", so my understanding is that a company is limited if it has >= 250 computer users, not 250 customers. E.g. you could have a million free app users and it would be fine.

That fact that I had to preface that with "my understanding is that" means that the document is fuzzy, which is annoying, but at least further documents[2] can clarify a bit:

> - Any individual developer can use Visual Studio Community, to create their own free or paid apps. > - In non-enterprise organizations up to 5 users can use Visual Studio Community. In enterprise organizations (meaning those with >250 PCs or > $1M in annual revenue) no use is permitted for employees as well as contractors beyond... [the exceptions as noted].

[2]: https://www.visualstudio.com/wp-content/uploads/2017/03/Visu...

So you (as an individual not as part of a company) could create a paid or mobile app and have as many users as you want and make as much as you can. If you're a company, then you need to be under 250 PCs, <= $1M, and <= 5 Visual Studio users and you're still good. Exceed those numbers and you have to pay up.

Re:Thoughts on Microsoft's Time-Travel Debugger on Sunday October 08, 2017 @12:49PM (#15428904)
> even the drug-pusher-like "Community" (first hit is free, unless/until you're making money) edition.

I mean, yeah it's not free-for-all, but "first hit is free" is kind of unfair. A company is not allowed to use it if they have more than "(a) more than 250 PCs or users or (b) one million U.S. dollars... in annual revenues" [1], and if it doesn't meet that criteria, it's usage is limited to 5 concurrent instances. More accurate would be "first hits are free, and you won't start getting charged until you're big enough where you can afford it".

Just making the distinction because I still have friends who think they can't use Community at home if they want to have a side project that makes money.

[1]: https://www.visualstudio.com/license-terms/mlt553321/

Re:.NET Standard 2.0 is final on Wednesday August 09, 2017 @03:21PM (#14972655)
I believe that .NET Core is not a subset of the .NET Framework; e.g. .NET Core might have things that are not yet in .NET framework.

I believe that the things that go into .NET core eventually go into .NET Standard (and thus the framework), but at a slower pace.

Thus it would be:

  .NET ECMA Spec ⊆ .NET Standard ⊆ (.NET Core ∩ Mono ∩ Xamarin ∩ Unity ∩ .NET Framework)
Re:Chrome Won on Friday May 26, 2017 @12:18PM (#14425127)
My understanding was that vivaldi wasn't completely open source either.

[0]: https://www.reddit.com/r/vivaldibrowser/comments/54kzpc/psa_...

Re:Pattern Matching for Java on Thursday April 20, 2017 @02:07PM (#14159208)
Ah, faster than the `ConcurrentDictionary`. That makes sense!
Re:Pattern Matching for Java on Thursday April 20, 2017 @02:05PM (#14159200)
> I am talking about what value you could pass into the multiple dispatch code in the article I linked to

Ah, I misunderstood the question. Yes, in that case it's fairly type-safe.

> The actual reflection going on in the code I posted for multiple dispatch would surely be nothing more than an int comparison

Is this based on gut reaction or are you talking about optimizations that `dynamic` performs? I ask because my understanding is that `dynamic` is like a really efficient reflection-emitter, that attempts to do at runtime the same thing that the compiler would do at compile time, but slower because it has to look stuff up via reflection.

From Eric Lippert [2]:

> The magic is: the compiler emits code that starts the C# compiler again at runtime. The runtime version of the compiler analyzes the call as though the compile-time types of all the objects had been their actual runtime types, generates an expression tree representing that call, compiles the expression tree, caches the delegate for next time, and runs the delegate.

[2]: http://stackoverflow.com/questions/10330805/c-sharp-multiple...

So maybe `dynamic` at runtime figures out that it can do a "a struct with an int tag to represent the type, and a void pointer for its value", but I wouldn't assume it does and from what I've read on it, I wouldn't think that it does.

Re:Pattern Matching for Java on Thursday April 20, 2017 @12:04AM (#14153848)
> I've found the DLR is just as fast... with a much lower overhead

Can you expand on this? I would not have expected that it would be faster than compiled expressions.

Re:Pattern Matching for Java on Thursday April 20, 2017 @12:02AM (#14153841)
> A dynamic type is probably just implemented as a tagged bit of data, surely

A dynamic "type" is really just `object` whose methods are looked up at run time. It's not tagged data at all. See [1] for more info, specifically the example(s) at the bottom, as the reflection code is what gets executed at run (albeit with caching so that methods aren't looked up all the time).

`dynamic` is a complex feature that enables multiple dispatch as a side-effect, but only because it allows a whole lot more.

[1]: https://visualstudiomagazine.com/Articles/2011/02/01/Underst...

> what arguments could you pass in to the statically typed function that would cause the use of dynamic to bite you in the ass

    public void Output(int value);
    public void Output(Person person);
    ...
    dynamic aValue = "Some String";
    Output(aValue);
Compiles, because the actual resolving of which overload to call is done at runtime, not at compile time. And at runtime, there is no overload that accepts a string.
Re:Pattern Matching for Java on Wednesday April 19, 2017 @05:58PM (#14152187)
> FYI, I recently found out that C# can actually do multiple dispatch

But also good to know, that it can be costly and unsafe. `dynamic` is basically using reflection at run-time, which for most cases is fine, but it's something to keep in mind. It also means that type checking is delayed until run-time instead of compile-time.

Re:Pattern Matching for Java on Wednesday April 19, 2017 @05:54PM (#14152155)
Reading this reminded me of all the discussions that took/are taking place for pattern matching in C#[0]; reading this I had the same reactions that I did for C#: cool stuff. It's also nice to see the languages reach parity in features; I only hope the two language committees pay attention to the research/feedback that the other receives.

[0]: https://github.com/dotnet/roslyn/issues/10153

Re:New Features in C# 7.0 on Friday March 10, 2017 @11:40AM (#13839861)
From https://github.com/dotnet/roslyn/issues/347 (Details > Mutability):

  > Should tuples be mutable or immutable? The nice thing about them being 
  > structs is that the user can choose. If a reference to the tuple is 
  > readonly then the tuple is readonly. 
  
  > Now a local variable cannot be readonly, unless we adopt #115 (which is 
  > likely), but that isn't too big of a deal, because locals are only used 
  > locally, and so it is easier to stick to an immutable discipline if you 
  > so choose. 
  
  > If tuples are used as fields, then those fields can be readonly if 
  > desired.

Older »