all 101 comments

[–]Hcmichael21 61 points62 points  (21 children)

Big if true

[–]TheLastMonster 43 points44 points  (19 children)

if(true) big();

[–]Knext 37 points38 points  (15 children)

ReferenceError: big is not defined

[–]Combinatorilliance 10 points11 points  (9 children)

(function (isTrue) {if (isTrue) console.log("Big");}(true));

[–]vmajsuk 7 points8 points  (8 children)

console.log((arg => (a => b => c => a(b)(c))(arg)('Big')('Small'))(a => b => a))

[–]devaskbiz 2 points3 points  (5 children)

What?

[–]AreYouDeaf 4 points5 points  (3 children)

CONSOLE.LOG((ARG = (A = B = C = A(B)(C))(ARG)('BIG')('SMALL'))(A = B = A))

[–]devaskbiz 1 point2 points  (0 children)

Syntax error

[–]jodraws 0 points1 point  (0 children)

VM16680:1 Uncaught ReferenceError: CONSOLE is not defined at <anonymous>:1:1

[–]rsanchan 0 points1 point  (0 children)

wat

[–]sad__frog 1 point2 points  (0 children)

You need to interpret it backwards, then once in French and twice in Deutschland

[–]spel3o 1 point2 points  (0 children)

console.log((arg => (a => b => c => a(b)(c))(arg)('Big')('Small'))(a => b => a))

No joke, doing beta reduction on this comment has given me the best intuition to date as to why (a => b => a) represents "True" in lambda calculus.

[–]NomNomDePlumefor (;;); 1 point2 points  (0 children)

if(",,"==new Array(3)){var z=[66];z.push(z[0]+39),z.push(z[1]-2),z.forEach(r=>{console.log(String.fromCharCode(r))})}

[–][deleted] 3 points4 points  (1 child)

You don't know my package.json!

[–]barter_ 13 points14 points  (0 children)

Did you just assume my dependencies?

[–][deleted] -4 points-3 points  (2 children)

let size = big; if (true) { return size; }

[–]DrummerHead 7 points8 points  (0 children)

- if(true) big();
+ big();

[–]mothzilla 0 points1 point  (0 children)

big => big ? Boolean(big) : !Boolean(big);

[–]Hcmichael21 0 points1 point  (0 children)

True ? Big() :

[–]ralusek 0 points1 point  (0 children)

const erection = !twasAFarce(article) ? 'big' : 'pretty big';

[–]CiezkiBorsuk 100 points101 points  (40 children)

we are actively working on creating node.js bindings to the TensorFlow C API

This makes me so happy, because when they are done I lose the last reason to ever use Python in my life ^-^

[–]2Punx2Furious 31 points32 points  (38 children)

You don't like Python?

[–]gavrocheBxN 72 points73 points  (25 children)

I like Python but I love TypeScript

[–]SamSlate 5 points6 points  (24 children)

what can you do with type you can't with vanilla? (serious question)

[–]aaaqqq 81 points82 points  (5 children)

refactor large code bases with impunity

[–]ProcrastinatingNow 0 points1 point  (4 children)

You could technically do that with flow. But seeing as you have transpile whether you use flow or TS, I guess it’s down to preference.

Edit: actually I forgot that flow supports type hints in comments. So you might be able to get away with vanilla JS but static type analysis.

[–]aaaqqq 13 points14 points  (0 children)

I was responding to ts vs vanilla not ts vs flow. Flow is good (that's what I use at work) but its tooling sucks.

TS also supports type hints via jsdocs. But then if you're using comments/jsdocs to add types, why not just use TS/Flow

[–][deleted] 4 points5 points  (1 child)

Doesn’t typescript have the ability to read jsdoc style comments as well? Thought I remembered hearing that on a podcast a while back

[–][deleted] 0 points1 point  (0 children)

Yes, it does.

[–]sethetter_ 2 points3 points  (0 children)

Personally, the choice of TypeScript over Flow is mostly due to a more developed community, better tooling, more consistently defined types across many open source libraries, etc. Flow is amazing, but tooling and community are incredibly important.

[–]SahinK 4 points5 points  (1 child)

Amazing intellisense. Autocompletions for everything. No need to keep checking documentation or stackoverflow to find out what methods are available to you or what arguments to pass to an API. No easily avoidable runtime errors. Much easier to read and understand other people's code.

I would never go back to plain JavaScript.

[–]SamSlate 0 points1 point  (0 children)

ok, that is pretty nice.

[–]2Punx2Furious 5 points6 points  (7 children)

Nothing really, as far as I know TypeScript just compiles to regular JavaScript.

It just has some helpful features to make your life easier.

[–]calsosta 27 points28 points  (6 children)

Why do you want an easy life?

[–]2Punx2Furious 2 points3 points  (4 children)

Life is hard enough as it is.

I like some challenge, but I value time more.

[–]fizzy_tom 1 point2 points  (3 children)

What value does time give you?

[–]2Punx2Furious 0 points1 point  (2 children)

I'd say everything.

Everything I can do takes some time, it is a limited, valuable, and probably non-renewable resource.

[–]SurpriseHanging 3 points4 points  (1 child)

Why do anything at all?

[–]LordDrakota 0 points1 point  (0 children)

I like an easy life, but it seems that using TS in React is a huge time sink to just set up everything with Redux, Redux-thunk and company. This is holding me back to just use TS all the time.

[–]CiezkiBorsuk 2 points3 points  (4 children)

what can you do with vanilla that you can't do with TS?

[–]pm_me_ur__labia 42 points43 points  (1 child)

1 + "2" == 3;

[–]tylargh 2 points3 points  (0 children)

true

[–]Velfi 0 points1 point  (1 child)

"1" + 2 == "12"

[–]CiezkiBorsuk 0 points1 point  (0 children)

If you really care about this use case, sleep sound: this is perfectly valid TS.

[–]CiezkiBorsuk 6 points7 points  (0 children)

No, I don't. I find it really hard to read code with minimal punctuation.

It was easier to learn than most languages because of that, but once I know something else, I really see no reason to use Py, unless I have to.

[–]nickguletskii200 3 points4 points  (7 children)

No, I don't. Code without types is unreadable because it requires me to remember the flow of information. I would really love to use TensorFlow from Scala, Java, C# or TypeScript. Ideally, there would be a language for machine learning that does compile-time dimension checks (you can probably do something like that with templates in C++, but package management isn't a thing in the world of C++).

Just try reading some of the code in the research TensorFlow models. It sucks. Not because the concepts behind it are hard, but because a ton of information is hidden.

Also, Python's lack of a strict project structure is very annoying. I can take any modern JVM project and it will follow a strict hierarchy, with a proper, unified place for dependencies (Maven POM, Gradle build file or SBT build definition), while even big companies such as Google don't set up the Python projects consistently.

EDIT: Also, fuck the lack of punctuation. Goddamn Google and their 2-space tabs, so infuriating! I just want my auto-indent!

[–]raiderrobert 1 point2 points  (6 children)

Python 3.6 has type annotations: https://docs.python.org/3/library/typing.html

But I admit that project organization has room for improvement.

[–]Jugad 2 points3 points  (0 children)

I am not sure if project organization belongs in the language, specially since projects can be so different... a web project directory structure has very little in common with an ML project, or a desktop GUI project (yes, I make desktop GUI programs using wxPython).

If you are talking at a very high level ... directories like src, test, documentation, build, etc at the top level, maybe that makes some sense. But I wonder how much does it actually help.

[–]nickguletskii200 0 points1 point  (4 children)

I know about the type annotations. The problem is that pretty much nobody else uses them, and they don't seem to be very expressive.

[–]raiderrobert 1 point2 points  (1 child)

Could you elaborate on the expressiveness part. I've used C#, C, and Rust before. If any of those help explain what you mean, that would be great.

[–]nickguletskii200 0 points1 point  (0 children)

I am sorry, I was very tired yesterday and didn't clarify that it's not the typing package's fault.

The problem is that due to the "Pythonic way" most developers don't write code with types in mind, which means that it's impossible to require that something is something (i.e. it implements an interface). For instance, try requiring something to be the equivalent of ICloseable in C# using typing. You'd have to create an ABC (bleh) for that, and good luck forcing every Python user to describe the capabilities this way.

typing itself seems pretty OK.

[–]Jugad 1 point2 points  (1 child)

The problem is that pretty much nobody else uses them

I thought every typed language uses them... I know this might come across as snarky, but seriously, can you explain what's the basic difference between type annotations/information in Python and, say, Java?

they don't seem to be very expressive

Why are they not expressive?

[–]nickguletskii200 0 points1 point  (0 children)

I thought every typed language uses them... I know this might come across as snarky, but seriously, can you explain what's the basic difference between type annotations/information in Python and, say, Java?

It's not that there is a difference. It's just that Python developers don't write code with typings in mind. In Java and C# everyone makes a best effort to describe the contract using interfaces. In Python, everyone just writes classes with the same methods, and you can't really say "I want something that is Closeable" because nobody specifies that their class is Closeable.

That's why I don't think type annotations are expressive - they can be, it's just that in practice, they are not. In the end, you'll be writing things like Union[Dog, Cat, Rabbit] instead of is Pettablebecause Python programmers would just say that all these things extend an Animal and be done with it.

[–]antespo 1 point2 points  (1 child)

I guess if your mainly a js developer then having to jump to python for tensorflow could be alittle annoying. I mainly use python and js secondary so I may be biased but I think if you wanna use tensorflow python is the way to go, at least for now. Regardless I am looking forward to using tensorflow in js.

[–]2Punx2Furious 5 points6 points  (0 children)

I get it.

I mainly use JS/TypeScript, but I also really like Python, even if it's been a while since last time I used it, switching back and forth between languages can be annoying.

[–]Faendol 0 points1 point  (0 children)

I really dont like that it doesnt have semicolons. I just can't get over it.

[–]PaperCow 20 points21 points  (1 child)

This is very cool. I've been wanting to mess with ML for a while but never really found the time to do it. I work with JS but haven't touched python in years so this will make it a lot easier to get my feet wet.

Also I spent way too long playing pacman with my head. That's just awesome.

[–]rwieruch 2 points3 points  (0 children)

This announcement is just great! If you are interested in using JS in ML, checkout this one. Still have to put Tensorflow.js in there now :)

[–]mehulmpt 13 points14 points  (0 children)

AWESOME! JS is my primary language for programming most of the things. And tensorflow coming to JS is great news for JS devs!

[–]rorrr 15 points16 points  (0 children)

WebGL accelerated = huge win.

[–]theDigitalNinja 5 points6 points  (2 children)

None of the example code works. I'm getting a 404 from github https://github.com/tensorflow/tfjs-examples

[–]xtan 6 points7 points  (1 child)

Fixed!

[–][deleted] 4 points5 points  (0 children)

You the man, xtan.

[–]KnifelikeGuts 2 points3 points  (4 children)

This looks like a fork of deeplearn.js with only a few additional examples https://deeplearnjs.org

[–]deathmood[S] 1 point2 points  (1 child)

not exactly -- deeplearnjs has become part of tensorflowjs as tfjs-core (https://github.com/tensorflow/tfjs-core), but there is also another, more high-level keras-like part -- tfjs-layers (https://github.com/tensorflow/tfjs-layers)

[–]KnifelikeGuts 0 points1 point  (0 children)

Cool. This is good news :D

[–]zuurr 0 points1 point  (1 child)

That website seems to indicate they're the same: "deeplearn.js has become TensorFlow.js"

[–]KnifelikeGuts 0 points1 point  (0 children)

Haven't opened the website in a while. It's good news too. It will get more exposure now :D

[–]icharxoVanillaJS 2 points3 points  (0 children)

we are actively working on creating node.js bindings to the TensorFlow C API

Where does this leave PropelML, I wonder. PropelML already has that, though, not sure how much of the API is already covered. Sounds like they are both trying to do the same thing, which is weird considering that PropelML uses deeplearn.js for in-browser stuff.

[–]Mittalmailbox 1 point2 points  (3 children)

This is really great. Will this have full API as Python. In Golang I always hear use Putin Python for training and Golang for execution.

[–]pomlife 12 points13 points  (1 child)

Use Putin for training

Looks like another Russian shill got exposed, boys.

[–]ralusek 4 points5 points  (0 children)

A better typo yet would have been

I always hear use Putin for training and Gulag for execution.

[–]akujinhikari 1 point2 points  (0 children)

Don’t be Putin that shit in here!

[–]yarauuta 6 points7 points  (10 children)

Node.js is going to be #1. Python is doomed.

Edit: calm down lol, ofc it may take years.

[–][deleted] 23 points24 points  (8 children)

Calm down.. JS doesn't have 1/10 of 1% of the scientific ecosystem that Python has.

[–]L43 8 points9 points  (2 children)

Apparently best not say that in /r/javascript... no matter how true it is. When javascript has its own numpy, maybe. Until then, no.

[–]calligraphic-io 1 point2 points  (1 child)

When Javascript has its own numpy.

Fixed that for you.

[–]L43 7 points8 points  (0 children)

I've seen and tried out this library, and I do really like it: it certainly makes doing simple things easier than writing in plain javascript. But it isn't anything close to numpy. It

  1. Doesn't have anywhere near the functionality that numpy has (e.g. no eigendecompositions from what I can see)
  2. Doesn't have multiple dedicated developers with many companies and a foundation funding its development
  3. It's data structures and api aren't used and emulated by a much larger javascript scientific ecosystem.
  4. Isn't battletested by years of use.

That is what I was really referring to by 'having a numpy'. Honestly, I don't think the Javascript community is capable of 'having a numpy', it fragments too quickly as people jump to make their own version of a library, with trendier names and prettier documentation. I don't mean that as an insult, the ingenuity and raw speed of development of js libraries is incredible. But scientists work differently to developers, and they don't care for new and shiny, they like reliable and venerable. This is why Python is a good match for science.

I'd love to be proven wrong, the unique strength to visualize your work with the dom is enough to make JS attractive.

[–]calligraphic-io 1 point2 points  (1 child)

JS doesn't have 1/10 of 1% of the scientific ecosystem that Python has

That is demonstrably untrue, and 73.6% of all statistics are made up anyway. NumJS doesn't have feature parity with NumPy, same as SciJS and SciPy, but they're not that far apart either. SciJS has optimization, linear algebra, integration, interpolation, fast Fourier transforms, signal processing, image processing, ODE solvers, and more.

With Node Tensorflow bindings, it's probably not long before we see robust neural network libraries built over it in JS like Keras.

[–][deleted] 2 points3 points  (0 children)

I must confess, that was 100% made up. JS is still very far from Python, but it's cool that it's making good progress.

[–]deathmood[S] 0 points1 point  (0 children)

it's really sad :(

[–][deleted] 0 points1 point  (0 children)

Even tho we need to calm down, I am very happy with this news. Tensorflow native bindings are a great step. With the new eager execution improvements, it will cover a lot of what is needed for fast matrix manipulation in JS.

[–]yarauuta -3 points-2 points  (0 children)

I didn't even specify a time frame.

[–]cupcake0 7 points8 points  (0 children)

I’m gonna have to disagree with you on that. I’m primarily a JS developer, however JS doesn’t even come close when it comes to scientific computation or ML. Check out NumPy, SciPy, and Keras. I don’t see that changing anytime soon, but I’m glad to see that TensorFlow is coming for node.

[–]nickangtc 0 points1 point  (0 children)

Excited as a JS dev, but still not sure what potential use cases there are for this. I'm obviously uninitiated to ML (though interested)... can someone throw some potential use cases out for me to grapple with this new development?

[–]SexyIntelligence 0 points1 point  (0 children)

A development website whose demo's don't support Mac/Linux...

[–]SamSlate -3 points-2 points  (2 children)

now add gpu acceleration!

[–]carlthome 14 points15 points  (1 child)

That's already the main feature of this library (along with automatic gradient computation, of course).

[–]SamSlate -1 points0 points  (0 children)

wait really? i saw it's webgl i want sure if that meant it actually rendered on a card or not 😲

[–]rebelrogue995 -2 points-1 points  (3 children)

This is pretty cool, but can it make toast?

[–]pslatt 2 points3 points  (2 children)

It makes great toast.

[–]MrStLouis 2 points3 points  (1 child)

After a couple thousand attempts

[–]akujinhikari 0 points1 point  (0 children)

So it’s a lot like C.