News for hackers. Stuff that matters.
Re:Announcing Dart 2 Stable and the Dart Web Platform by fullofsid on Tuesday August 07, 2018 @10:54AM (#17707163)
Anybody using only dart for their mobile apps, how has been your experience with it? Where does it triumph & fail over RN??
Re:Announcing Dart 2 Stable and the Dart Web Platform by kasperpeulen on Tuesday August 07, 2018 @11:01AM (#17707220)
Pros:

* Flutter is faster. You really notice that for example the animations in flutter are much smoother than in RN

* Flutter has really fast development cycle with hot reload (< 1s)

* Writing UI only once for both iOS and Android

* Better documentation

* Better tooling support in editors (VSCode and Intellij)

Cons:

* The Flutter ecosystem is quite small, there are many lacking plugins

* The Dart ecosystem is way smaller than JS

* RN uses the native widgets, in Flutter they are mimicked and sometimes wrongly, for example the iOS datepicker

Re:Announcing Dart 2 Stable and the Dart Web Platform by devxpy on Tuesday August 07, 2018 @11:38AM (#17707590)
To add to this -

* Developing plugins (to use native code functionality) is fairly easy. I recently created a PDF viewer plugin for Android without any prior knowledge of java, in 2 days.

* Dart has smaller ecosystem but dart is a real language with a batteries included std library. I don't think I need to state the superiority of dart as a language.

* Flutter's non native components make it easier for you to customize them

* Flutter doesn't have an obvious way to use native views in apps. You can launch native views but compositing native and flutter views is a bit weird right now.

* The ease of use in the development cycle is phenomenal. Nothing like I've ever seen in UI dev.

Re:Announcing Dart 2 Stable and the Dart Web Platform by realusername on Tuesday August 07, 2018 @11:08PM (#17712919)
I would add on the Cons that Flutter is a bit more verbose than React-native since it does not have JSX. And also on the Pros that the community is much nicer on Flutter, RN is Facebook's own pet project and it's very visible when you run into issues.
Re:Announcing Dart 2 Stable and the Dart Web Platform by sbjs on Tuesday August 07, 2018 @11:49AM (#17707696)
Since there's so much competition in this area, hopefully this means Apple and Google will start to make this style of development a native part of their APIs and IDEs.
Re:Announcing Dart 2 Stable and the Dart Web Platform by beckler on Tuesday August 07, 2018 @03:10PM (#17709613)
My only complaint so far is some things are not documented very well.

I started leveraging the json_serializable lib and all my responses were returning null... it took me a few days of heavy debugging to figure out it was how I crafted my constructors and how the code generators worked with it.

Re:Announcing Dart 2 Stable and the Dart Web Platform by devxpy on Tuesday August 07, 2018 @10:48PM (#17712844)
Thankfully, the community is really welcoming. Not like RN where issue are closed for no reason all the time..
Re:Announcing Dart 2 Stable and the Dart Web Platform by vyrotek on Tuesday August 07, 2018 @11:08AM (#17707276)
It's been a pleasure to work with the past month. Traditionally I've worked with Cordova/Ionic and I feel far more productive than I have before on mobile. I was skeptical of the Dart language but now I've seen it's similarities with C# and really enjoy it. The whole widget model is pretty nice to work with too.

The experience of going from zero to HelloWorld with VSCode was so smooth. The community has done an excellent job with the VSCode extensions. Things like picking/install/starting an emulator is quick and intuitive as opposed to the work it takes to initially get thing Xamarin installed and running.

Hot reloading works well on a device or emulator and is really quick! There isn't support for remote updating (yet) once you've published to a store though. There is a GitHub issues tracking this.

I'm a fan. I hope the community grows around it.

Re:Announcing Dart 2 Stable and the Dart Web Platform by darpa_escapee on Tuesday August 07, 2018 @11:32AM (#17707525)
Dart is a nice statically typed and compiled C-style language. If you have experience with another such language, it will feel like you already know Dart. The language compliments Flutter well, and the Flutter SDK makes it simple and easy to rapidly build a functional mobile app.

Lack of certain features, like reflection, in mobile Dart creates a rift in packages you can utilize in a Flutter app. There are a few warts in the type system, mainly around generics, and little things like the lack of union types and type aliasing.

There are also a few outstanding bugs that you might run into, which have had relatively long life since they were identified. The Dart team seems to be reluctant to add new features.

Also, managing state in Flutter is a little unclear: documents and videos from Google recommend four different ways to do so: explicitly calling setState(), Streams with StreamBuilder, scoped_model and the various third-party Dart/Flutter Flux implementations.

It definitely beats native development.

Re:Announcing Dart 2 Stable and the Dart Web Platform by EugeneOZ on Tuesday August 07, 2018 @12:18PM (#17707957)
Language with "dynamic" type can't be called "statically typed".
Re:Announcing Dart 2 Stable and the Dart Web Platform by drb91 on Tuesday August 07, 2018 @12:29PM (#17708082)
Most languages I can think of have this type, from void* to dyn to bounding by the root of the type hierarchy. Not all languages. However, what is c, c++, java, rust, go, if not statically typed? Ambiguously typed? Seems like not a useful distinction to make.

I argue static typing is the ability to static type up to 100% of a program, not the exclusion of a dynamic type.

Re:Announcing Dart 2 Stable and the Dart Web Platform by EugeneOZ on Tuesday August 07, 2018 @12:54PM (#17708312)
Rust doesn't have such type. And type annotations in Dart are optional - when programmers are not obliged to use them, guess what will happen? They do NOT use them. People are lazy.

Dart's types exist only on compilation step. You can try to use "strong mode" in theory, in practice you will never compile it with third-party libraries.

Re:Announcing Dart 2 Stable and the Dart Web Platform by munificent on Tuesday August 07, 2018 @01:27PM (#17708626)
> And type annotations in Dart are optional - when programmers are not obliged to use them, guess what will happen?

The type system will infer a static type based on the type of the initializer.

In some cases, inference may fail to infer a type. Right now, that can silently give you dynamic, but there's a flag to make that an error. I expect before too long that will be the default behavior.

Re:Announcing Dart 2 Stable and the Dart Web Platform by foldr on Tuesday August 07, 2018 @12:59PM (#17708351)
Rust has both raw void* pointers (within unsafe code) and the safe std::any::Any trait: https://doc.rust-lang.org/std/any/trait.Any.html
Re:Announcing Dart 2 Stable and the Dart Web Platform by EugeneOZ on Tuesday August 07, 2018 @01:04PM (#17708385)
Trait is not a type, Any is just a custom trait. Types: https://doc.rust-lang.org/book/second-edition/ch03-02-data-t... You can create trait with name "Magic" or "Fuck" and it will not mean anything. Pointers is not a type also.
Re:Announcing Dart 2 Stable and the Dart Web Platform by drb91 on Tuesday August 07, 2018 @03:35PM (#17709838)
Ok, type bound. You can still easily pass around data whose type is not concretely defined at the compilation step. Unless you’re arguing that the dynamic type is actually static, in which case this whole conversation seems semantically pointless.
Re:Announcing Dart 2 Stable and the Dart Web Platform by EugeneOZ on Tuesday August 07, 2018 @04:19PM (#17710331)
2 hours ago I answered it already. If you're another person who wants to convince me that Rust has same thing as Dart's "dynamic" type, then please make my code example to compile (without modifications, for literally ANY type, as in Dart) and I will say I was wrong.
Re:Announcing Dart 2 Stable and the Dart Web Platform by drb91 on Tuesday August 07, 2018 @04:53PM (#17710689)
Dart type or rust type? They refer to different things, which is the source of the confusion, but they're both strongly typed.

In any case, you're moving the goal post from "concrete type at compile time" to "can represent any type", which is inherently going to be specific to how the language defines types. This is not an especially useful type of dynamic representation so I'm not sure why it would be desirable.

Re:Announcing Dart 2 Stable and the Dart Web Platform by EugeneOZ on Tuesday August 07, 2018 @05:27PM (#17710981)
There is no confusion. Rust doesn't have dynamic type and Dart does. That's it.

Any talks about special traits in Rust are offtopic, while code I wrote as example can't be compiled in Rust and can perfectly work in Dart.

I wasn't trying to argue about words or terms, I was trying to say the gist: Dart has dynamic type, so you can send to your function any type and this function will just use it, without any downcasting - language will take care about it; and Rust doesn't have such type: you can't even compile code which is trying to work with variables like you can do in dynamic languages.

But then all of that useless arguing... It's really funny when I see how people are trying to prove that Rust has same dynamic type as Dart. The very nature of these languages is different.

Re:Announcing Dart 2 Stable and the Dart Web Platform by foldr on Tuesday August 07, 2018 @01:07PM (#17708423)
Pointers are certainly types in Rust, and although it's of course true that the Any trait is not itself a type, a reference to an Any trait (which is what you'd actually pass around) is a type.
Re:Announcing Dart 2 Stable and the Dart Web Platform by EugeneOZ on Tuesday August 07, 2018 @01:15PM (#17708501)
Well, you can repeat it many times but it will not become true. I gave you link to the list of Rust types. Pointers are pointers, not types. Traits can have any name, their names mean nothing.
Re:Announcing Dart 2 Stable and the Dart Web Platform by foldr on Tuesday August 07, 2018 @01:22PM (#17708571)
https://doc.rust-lang.org/book/first-edition/raw-pointers.ht...

    *const u32
(for example) is a clearly a Rust type -- a const pointer to an unsigned 32-bit integer, analogous to

    const uint32_t *p
in C/C++.

I'm not sure what you mean about trait names. The purpose of the Any trait is to make it possible to pass around values of any type and dynamically downcast them, as the documentation indicates. That is a safe analogue of casting a void pointer to another type.

Re:Announcing Dart 2 Stable and the Dart Web Platform by EugeneOZ on Tuesday August 07, 2018 @01:43PM (#17708767)
To be dynamic, "Any" should be able to represent literally ANY type. As you can find, Any is a reflection-wise trait to work with static types. It's not something what you can use when you don't know type and language will dynamically convert it. You can't write

    fn example(foo: Any) -> u32 {
        foo+55
    }
as you CAN do in dynamic languages. Do you understand me now? Or we will keep talking about unsafe extra special types?
Re:Announcing Dart 2 Stable and the Dart Web Platform by rhencke on Tuesday August 07, 2018 @01:52PM (#17708851)
Please remember there's a genuine human on the other end, trying to have a respectful conversation with you.
Re:Announcing Dart 2 Stable and the Dart Web Platform by EugeneOZ on Tuesday August 07, 2018 @02:55PM (#17709485)
Or there is a person who is trying to prove his offtopic point by some pedantic interruptions, which are far from the main idea of discussion.
Re:Announcing Dart 2 Stable and the Dart Web Platform by foldr on Tuesday August 07, 2018 @01:52PM (#17708854)
You can do that if you change it to &Any and then downcast. See the docs for examples. If the issue is that you have to downcast, then your initial claim that Rust lacks void pointers was irrelevant even if true, since you also have to downcast a void pointer in C before you can perform operations on the type that it's actually pointing to.
Re:Announcing Dart 2 Stable and the Dart Web Platform by xfer on Tuesday August 07, 2018 @03:34PM (#17709831)
You can't downcast it to anything you want, it returns an Option, void pointers in C are not certainly the same, it's unsafe.
Re:Announcing Dart 2 Stable and the Dart Web Platform by foldr on Tuesday August 07, 2018 @03:49PM (#17709992)
I know. That's why I said it's "a safe analogue of casting a void pointer to another type".
Re:Announcing Dart 2 Stable and the Dart Web Platform by EugeneOZ on Tuesday August 07, 2018 @02:54PM (#17709466)
> If the issue is that you have to downcast

It's the difference between dynamic language and language with synthetic type for reflections.

Re:Announcing Dart 2 Stable and the Dart Web Platform by leshow on Tuesday August 07, 2018 @04:04PM (#17710175)
A pointer is absolutely a type in rust.

let i: u32 = 1;

let p_imm: const u32 = &i;

Look at the const u32 in the type position.

The rust book even refers to const and mut pointers as types.

Re:Announcing Dart 2 Stable and the Dart Web Platform by EugeneOZ on Tuesday August 07, 2018 @07:22PM (#17711835)
const and mut are not types, it's modifiers of mutability. On both lines type is u32z
Re:Announcing Dart 2 Stable and the Dart Web Platform by foldr on Wednesday August 08, 2018 @06:31AM (#17714637)
The asterisks in leshow's comment are being lost in the formatting, since HN uses them for italicization. So the last line, for example, is:

    The rust book even refers to *const and *mut pointers as types.
Re:Announcing Dart 2 Stable and the Dart Web Platform by EugeneOZ on Wednesday August 08, 2018 @01:41PM (#17717805)
I really can't believe how stupid people can be to say "const" is a type. Even if Klabnik will say it into my face it will not be true, I don't care about the book he wrote.
Re:Announcing Dart 2 Stable and the Dart Web Platform by foldr on Thursday August 09, 2018 @06:22AM (#17722954)
leshow said that

    *const u32
is a type, not that 'const' is a type. HN's formatting removed the asterisk, as it uses asterkisks for italicization.
Re:Announcing Dart 2 Stable and the Dart Web Platform by leshow on Wednesday August 08, 2018 @09:41AM (#17715822)
The asterisk was formatted out. Read the book, they are types.
Re:Announcing Dart 2 Stable and the Dart Web Platform by EugeneOZ on Wednesday August 08, 2018 @01:38PM (#17717789)
So you can write "let x:const = 5"? if "const" is a type.
Re:Announcing Dart 2 Stable and the Dart Web Platform by leshow on Friday August 10, 2018 @10:16AM (#17733423)
You were just told the formatting removed the asterisk. const isn't a type, but a const pointer is, so is a mut pointer. It says so in the book AND it's in the position of a type in the code. What other information do you need to convince you that you're wrong?
Re:Announcing Dart 2 Stable and the Dart Web Platform by drb91 on Tuesday August 07, 2018 @03:36PM (#17709842)
Dart isn’t statically typed, at least not in the times i’ve used it; it’s gradually typed.
Re:Announcing Dart 2 Stable and the Dart Web Platform by munificent on Tuesday August 07, 2018 @08:56PM (#17712324)
It was optionally typed. Dart 2 is statically typed.
Re:Announcing Dart 2 Stable and the Dart Web Platform by darpa_escapee on Tuesday August 07, 2018 @01:21PM (#17708562)
If you have a well-thought out argument, and not a quippy one-liner, I'd earnestly like to hear it.

Dart's developers think otherwise[1]:

> Q. Is Dart a statically typed language?

> Yes, Dart 2 is statically typed. For more information, see Dart’s Type System.

> With its combination of static and runtime checks, Dart has a sound type system, which guarantees that an expression of one type cannot produce a value of another type. No surprises!

> Even with type-safe Dart, you can annotate any variable with dynamic if you need the flexibility of a dynamic language. The dynamic type itself is static, but can contain any type at runtime. Of course, that removes many of the benefits of a type-safe language for that variable.

[1] https://www.dartlang.org/faq#q-is-dart-a-statically-typed-la...

Re:Announcing Dart 2 Stable and the Dart Web Platform by EugeneOZ on Tuesday August 07, 2018 @01:26PM (#17708606)
> With its combination of static and runtime checks

Do you personally use it? That "strong mode" is a theory-only thing, it doesn't work with any real code, only with code you wrote without real third-party libraries.

Re:Announcing Dart 2 Stable and the Dart Web Platform by dragonwriter on Tuesday August 07, 2018 @01:29PM (#17708646)
You are, at best, confusing Dart 2 with Dart 1; strong mode was one of several Dart 1 modes, but, yes, it's possible to run into problems because dependencies weren't designed for it.

There is no option in Dart 2; everything is the equivalent of strong mode, which eliminates ecosystem problems.

Re:Announcing Dart 2 Stable and the Dart Web Platform by EugeneOZ on Tuesday August 07, 2018 @01:45PM (#17708790)
I mentioned I've only tried Dart 1.x. Glad to hear it's changed in Dart 2.
Re:Announcing Dart 2 Stable and the Dart Web Platform by munificent on Tuesday August 07, 2018 @02:13PM (#17709066)
> only with code you wrote without real third-party libraries.

Your claim was true several years ago, but since then the entire ecosystem has migrated onto the new strict type system. It was a monumental amount of work, but, thanks to lots of effort from our users, we're there.

Aside from a small number of more-or-less dead packages, you should be able to use any third-party Dart packages you want while still using the new type system.

Re:Announcing Dart 2 Stable and the Dart Web Platform by munificent on Tuesday August 07, 2018 @01:26PM (#17708607)
C#, Scala, Kotlin, TypeScript, et. al have a dynamic type. As long as every type isn't dynamic, I think it's reasonable to claim you have static types.
Re:Announcing Dart 2 Stable and the Dart Web Platform by mraleph on Tuesday August 07, 2018 @12:28PM (#17708074)
Is C# statically typed?
Re:Announcing Dart 2 Stable and the Dart Web Platform by panopticon on Tuesday August 07, 2018 @01:11PM (#17708465)
Yes, it is.
Re:Announcing Dart 2 Stable and the Dart Web Platform by EugeneOZ on Tuesday August 07, 2018 @12:47PM (#17708259)
I don't know.
Re:Announcing Dart 2 Stable and the Dart Web Platform by EugeneOZ on Tuesday August 07, 2018 @05:35PM (#17711055)
Really happy to see this absolutely honest and neutral answer downvoted. It says a lot about the level of my opponents.
Re:Announcing Dart 2 Stable and the Dart Web Platform by dudleyf on Tuesday August 07, 2018 @11:24PM (#17712993)
It says a lot that you consider folks you're having a conversation with "opponents".
Re:Announcing Dart 2 Stable and the Dart Web Platform by EugeneOZ on Wednesday August 08, 2018 @01:02AM (#17713311)
Anybody who is arguing with you is your opponent. It's not so dramatic word :)
Re:Announcing Dart 2 Stable and the Dart Web Platform by sidstling on Tuesday August 07, 2018 @11:13AM (#17707326)
I work for a Danish city with 60.000 inhabitants, so we're a small team, and because of that we looked into flutter since it seems like an easy way to do mobile for people apt at c-like languages. We even had some internal talks about angularDart and flutter being comparable to react and reactNative.

Our proof of concept wasn't that much of a hit though. Flutter integrates really, really well with Firebase, but being the public sector in Europe, I don't see us using Google cloud anytime soon. Without it we couldn't really get a full stack dart thing running because stuff like aqueduct isn't mature enough, and is really hard to run within Azure. At least if you want to run comparable to other options seeing how application insights even works on Node.

Dart is a nice language, and Flutter is certainly an easy way to do mobile apps, but I don't see us using either, unless they becomes much more popular.

Re:Announcing Dart 2 Stable and the Dart Web Platform by netheril96 on Tuesday August 07, 2018 @11:22AM (#17707412)
Why is the public sector in Europe staying away from Google but not Microsoft (Azure)?
Re:Announcing Dart 2 Stable and the Dart Web Platform by sidstling on Tuesday August 07, 2018 @11:30AM (#17707498)
Microsoft was a lot faster to accept and accompany our privacy terms. The EU data protection laws that you've seen all the fuzz about may be new for the private sector, but in much of the public sector we've actually been under much stricter requirements for years. If you have a big enough agreement with Microsoft, you can even have your data stored on servers you have physical access to and share with no-one else.

AWS was a little slower, but now meet the same requirements, pretty much. Other parts of the public sector is big in AWS instead of Azure.

Google only recently got into any type of real agreements with the EU on data protection, and they're still far from having national agreements. They also don't meet EU requirements on all their products, making it easier to blacklist all Google products than risk your GIS department using Google Maps or your PR department using Google analytics, both illegal for public usage.

For us personally we have more than 25 years of partnership with Microsoft, who have an excellent record on support. By contrast we've never really worked with Google, and we're not typically the ones to try new things. :) Especially not when we're happy with what we have, and since we already have a presence in Azure, I doubt we'll be expanding to another Cloud when pricing is pretty competitive between them. I mean, to run two clouds would also mean our operations crew would need to obtain security certifications for both, which is fairly expensive.

Technically and legally we could sign an agreement for Firebase in particular, and host our mobile apps with a Firebase backend, but as that's not likely to happen, Dart would need to become popular enough to integrate seamlessly and easily with Azure for us to use it.

Re:Announcing Dart 2 Stable and the Dart Web Platform by detaro on Tuesday August 07, 2018 @11:27AM (#17707464)
One reason could be that from what I understand Azure licenses it's cloud software to other providers ("Azure Stack"), so you can get "Azure" run by a European company in an European data center, or even a state-owned one.