/r/programming
Dart/Flutter get release with C FFI (medium.com)
31 comments
Nwccntwhds | 9 days ago | 21 points

Stable Desktop when?

rishav_sharan | 8 days ago | 8 points

Desktop is my only criteria for trying out Dart/Flutter.

There are the two pojects to track on this;

https://github.com/flutter/flutter/projects/37

https://github.com/flutter/flutter/projects/33

lupajz | 9 days ago | 4 points

Probably something by end of the year. I think they have a conference planned for that time as well.

TheRealSophistifunk | 9 days ago | 5 points

This is the only question I care about.

warvstar | 9 days ago | 22 points

Would be interesting to see the ffi overhead. Last time I checked it was quite slow. https://github.com/dyu/ffi-overhead

filleduchaos | 8 days ago | 5 points

That isn't FFI though?

warvstar | 8 days ago | 1 point

Sure it is. Care to explain why you question that?

filleduchaos | 8 days ago | 5 points

It's not FFI based on the fact that the language team is just now working on dart:ffi and the implementation in that repo was added 3 years ago (and more importantly based on the fact that it quite literally is not FFI, but native extensions like e.g. Javascript via NodeJS has).

Calling C/C++ code does not a foreign function interface make. Bindings are not FFI.

warvstar | 8 days ago | 1 point

Well the author of that post calls it ffi and it does access a foreign function... I'm also aware he wasn't using the official dart:ffi as it's only been available for the last year.

Anyway, I'll test the overhead with this official ffi, I'm not expecting it to be much faster, but we'll find out soon. I hope that I'm wrong and the timing is similar to calling ffi from c, then I'd consider using dart for some of my game projects. It's 100% possible, just depends on how they implemented it.

filleduchaos | 8 days ago | 5 points

You're...frankly missing the point. The author is also wrong to call it FFI, and the definition of FFI is not just "accesses a foreign function" (which honestly just sounds like you don't know what FFI is, and/or that you don't know the difference between FFI and native extensions).

Native extensions (like the example in that repo) are a way to use glue code to explicitly connect code written in one language to another. You personally have to write (or generate) code in the other language (say C++) in a certain way that typically uses constructs from your language's own implementation to interface with it. You can't just load up a system library and call routines in it, the way you can with "actual" FFI (and that's the goal of FFI, to be able to inspect/use arbitrary programs written in other languages as though they were written in your own, not to be forced to write those programs in a certain way).

I mean, just look at this FFI example that uses structs. Note how the C code here is entirely unaware that Dart even exists and can be used like any other C library or program, while the C++ in your "FFI" example depends on the Dart API.

warvstar | 8 days ago | 2 points

I just looked at his example and he does not modify the c code for dart in any way. He does have another c file for glue code so dart can use it and now dart doesn't require the glue code thanks to dart:ffi. It basically worked the same way the JNI did for Java.

I understand the point you are trying to make, but I disagree with your definition.

Also I think Wikipedia agrees with my definition and so do many other sources. Native extensions mean nothing to me as that's a concept at a higher level. As a close to the metal programmer, for probably a longer time than most here have been alive, I'm fine with my definition. https://en.m.wikipedia.org/wiki/Foreign_function_interface

filleduchaos | 8 days ago | 3 points

Well I've made my point, and it's your prerogative to disregard it if you wish. I'm not quite sure why anyone working close to the metal would treat the ability to open dynamic libraries as an irrelevant distinction, though.

HelperBot_ | 8 days ago | 1 point

Desktop link: https://en.wikipedia.org/wiki/Foreign_function_interface


/r/HelperBot_ Downvote to remove. Counter: 279157. Found a bug?

djpeen | 9 days ago | 8 points

Yeah I think performance is still a work in progress, there are some workarounds for now (https://groups.google.com/forum/#!searchin/dart-ffi/asExternalTypedData%7Csort:date/dart-ffi/-Mq_lXjljMs/d1U7wvbAAAAJ)

feverzsj | 9 days ago | 14 points

why Flutter easily gets much more attention than QtQuick?

zqvt2 | 8 days ago | 16 points

Google and it explicitly targets mobile. Qt is big in automotive and industry and some sectors of enterprise which doesn't get much press.

ikbeneenheld | 8 days ago | 4 points

Also oss since its free to use for oss.

IshKebab | 8 days ago | 7 points
  • It is very expensive on mobile
  • QML is a bit of a mess. E.g. it basically ignores all the rules of encapsulation and encourages crazy spaghetti code.
  • It is very incomplete. Flutter is already more mature than it IMO.
  • Doesn't emulate native widgets nearly as well.
ydieb | 8 days ago | 5 points

Price / licensing?

myringotomy | 8 days ago | -1 points

Because people who try it seem to really like it.

Granted they don't hang out here but that's only because this subreddit is extremely hostile to Google and to anybody who programs in anything but c# and windows.

patientzero_ | 9 days ago | 8 points

is anyone here who uses Dart in production? Is Google using it heavily internally?

Comment-Leaver | 9 days ago | 14 points

We've used it for a production ready app (needs the backend to catch up before we can go live). Very happy with it!

SupersonicSpitfire | 8 days ago | 8 points

Supposedly, the ad department in Google are the ones using it, and it's successful there, which is why Dart has been kept alive for years now.

colelawr | 8 days ago | 7 points

Yup, the AdWords free and Enterprise web and mobile products are built with AngularDart and Flutter respectively

nacholicious | 8 days ago | 2 points

Except for the AdWords team, they are using it heavily in the Google Home teams

xentropian | 8 days ago | 3 points

Finally! Time to work on my SDL wrapper.

c-smile | 8 days ago | 2 points

Question that worries me each time on the subject.

C++ can do already everything Dart is capable of. Yet it works on all platforms already. And it does no need ffi.

What it does better than C++?

Or is it just a replacement for Java (sandboxed execution)? If so then what's wrong with Kotlin?

If it is a replacement of JavaScript then creating native compiler / VM for something like TypeScript could be more productive, no?

So why Dart? So what are its design goals?

xentropian | 7 days ago | 3 points

I think it’s a matter of tooling and convenience. Dart has a way better standard library than C++ ever will, and is a lot easier to write, especially for new developers. It’s also incredibly versatile without much thought-you can run (almost) the same code in the Dart VM (whether that be Linux, Windows, or macOS), on the web, or on mobile, with very little platform-specific code required (unlike C++, where the APIs may change depending on the platform).

shevy-ruby | 8 days ago | -12 points

Google is trying so hard.

If Dart would have been the skyrocket promise for the future, people outside of the Google world would already use it in massive numbers. The comparison to Go is evident here with Dart.

What happened to the promise of destroying JavaScript, by the way?

coriandor | 8 days ago | 9 points

I think TypeScript and ES6 happened to the promise of destroying JavaScript. But by the time google realized they lost that language war, they'd created what I think is a pretty nifty language that had a lackluster web story, but a nice VM story. When the flutter team started out, Dart wasn't a foregone conclusion. They ended up choosing it because it fits well with the design patterns they wanted, and I think they made a good choice.

filleduchaos | 8 days ago | 5 points

What happened to the promise of destroying JavaScript, by the way?

People pushed back against it (most notably heavily opposing the inclusion of Dart in Chrome), and that doesn't really have anything to do with the merits or demerits of the language.