News for hackers. Stuff that matters.
Re:Swift for TensorFlow Shuts Down by nextos on Friday February 12, 2021 @03:11PM (#26118007)
I love all languages in the ML/Haskell tradition, but I think Julia would have been a better fit because it's dynamic yet efficient, and because it has a really decent probability/statistics/ML ecosystem already. Long term, I think it's the best replacement we have for Python in the ML world.

Python has exceptional libraries but, as a language, it's a bit dated on several fronts. This has an impact on library design. In Python, ML libraries are huge monoliths and they depend on a lot of code written in other languages. They are really hard to understand or modify.

In Julia, things are really small and composable. For example, you have a probabilistic programming library like Turing and a differentiable programming one like Flux, and it's trivial to implement some Bayesian neural networks. Same applies to many other things. It's small and beautiful, but it needs more manpower to compete against Python.

Re:Swift for TensorFlow Shuts Down by Karrot_Kream on Friday February 12, 2021 @03:41PM (#26118307)
> In Julia, things are really small and composable. For example, you have a probabilistic programming library like Turing and a differentiable programming one like Flux, and it's trivial to implement some Bayesian neural networks.

I was taken aback when looking at Turing for Bayesian modelling that the distributions were just the standard distributions found in the Distributions package! In Python, every Bayesian framework has its own implementation of everything from distributions to log probabilities, but it all composes in Julia.

> It's small and beautiful, but it needs more manpower to compete against Python.

Agreed. Docs of major projects are still incomplete or non-existent, there's a lot of projects that have been nigh abandoned (cough naive bayes cough), and the composability of Julia coupled without strong leadership leads to an ecosystem of overlapping functionality. Still, I hope by leveraging PyCall, Julia can overcome some of these issues.

Re:Swift for TensorFlow Shuts Down by renerthr on Friday February 12, 2021 @06:21PM (#26119754)
> but it all composes in Julia.

You mean that, in Julia, we the users have to "compose" our own implementations of models (e.g. log probabilities), as opposed to using the already-made ones in Python?

Re:Swift for TensorFlow Shuts Down by cwyers on Friday February 12, 2021 @06:40PM (#26119907)
More like... most of the scientific Python stack has settled on a third party library, NumPy, to provide support for numerical computing. That includes providing data types like arrays. Tensorflow doesn't use NumPy's data types, so if you want to use Tensorflow Probability, you need to convert everything you've done in NumPy (or things that are built on top of NumPy, like Pandas) to TensorFlow, and use TensorFlow's functions/methods to manipulate them.

(The same is true if you use something that's built on top of Stan or JAGS or BUGS or something else.)

In Julia's Turing.jl, everything is built around data structures that are first-class parts of Julia, so there's no need to have special Turing.jl versions of, say, probability distributions.

Re:Swift for TensorFlow Shuts Down by The_rationalist on Friday February 12, 2021 @10:03PM (#26121026)
Re:Swift for TensorFlow Shuts Down by dd82 on Saturday February 13, 2021 @09:12AM (#26123679)
yes, and if you go to that link, you can see its experimental, for TF 2.4 _and_ the notebook on github was created Aug 3, 2020. So that is relatively new and most likely has a ways to go before further adoption. Its good that option exists, but doesn't seem very backwards compatible. That doesn't negate the points made in the parent.
Re:Swift for TensorFlow Shuts Down by The_rationalist on Saturday February 13, 2021 @10:57AM (#26124312)
It will mature before the Julia ecosystem mature so the value proposition of Julia is out weighted by it's lack of ecosystem. Had they transparant interoperability with Python like Kotlin is for Java, I would consider it. They could at least rewrite their vm to use the truffle framework from graalvm so that they would become interoperable with Python on graal which in a few years will mature.
Re:Swift for TensorFlow Shuts Down by amkkma on Saturday February 13, 2021 @06:58PM (#26128274)
What do you know about the Julia ecosystem?
Re:Swift for TensorFlow Shuts Down by ddragon on Friday February 12, 2021 @06:57PM (#26120067)
If they weren't already-made in Julia yes (and a library didn't do the work of composing it and presenting as a monolith, since pretty much all large frameworks like Flux and DiffEq are also made this way). Although you're maybe trying to imply that everything that anyone needs is already made in python, I occasionally end up finding small issues between my use case and what's immediately available and I have to twist my problem into a stitch of "kinda what I need" pieces (like having to change my problem into a vectorization problem, a long chain of corrections using pandas to fit an interface and then some weird logic to transform the table into a CSV in memory to use postgres' COPY or UPSERT because pandas to_sql is not flexible enough and iterating and inserting is too slow). Sure I always achieve the result using already-made stuff, but the glue logic ends up taking more time and honestly ends up quite hard to maintain for other people (or even myself after a few months) after all it isn't my algorithm logic but some adhoc puzzle I just solved.

In Julia, if the DataFrame library is missing something I can just loop like an array and have a method that works just as well as if the library provided it, the CSV, DB and table processing libraries all use the same conventions so if library "A" solves my issue I'm not forced to use the same library "A" serialization method. Basically instead of twisting the logic to what I'm given, I just fill in the blanks. Sure Julia has way more blanks, but Julia also has half of the age of some of the Python's library I use, it's more about the maturity of the community than anything to do with the design choices of the language and I can only hope it gets better and better with time.

Re:Swift for TensorFlow Shuts Down by moelf on Friday February 12, 2021 @11:22PM (#26121376)
for example, if you have a relu activation function, it's literally just: relu(x) = max(zero(x), x)

now python has like 5 identical numpy-like API re-implemented in multiple framework. That's where resources is wasted (unnecessarily)

Re:Swift for TensorFlow Shuts Down by spamizbad on Friday February 12, 2021 @05:18PM (#26119187)
Julia gets compared a lot to Python but truthfully it strikes me as more like a replacement for FORTRAN, MATLAB, and R. The ergonomics of the language seem good but documentation is poor and as a community it's narrowly scoped into the ML/numerical processing world.

If all you do is ML/numerical processing, against data that's already been cleaned up, I bet it's really great tho.

Re:Swift for TensorFlow Shuts Down by socialdemocrat on Friday February 12, 2021 @06:13PM (#26119678)
The comparison is natural because Python is a general purpose language which happens to be used for data science, the same can be said about Julia. The others languages mentioned are not really that great for general purpose programming.

But I agree with you that in the short term it is a replacement for Fortran, Matlab and R. But a new language has to start somewhere. Attacking the niche filled by these language is natural as these are old, dated and ripe for disruption. The key is to gain some critical momentum and user base. That will carry the language to other domains.

Re:Swift for TensorFlow Shuts Down by swagonomixxx on Friday February 12, 2021 @04:07PM (#26118555)
> Python has exceptional libraries but, as a language, it's a bit dated on several fronts.

I've been using Python for ML for the last 3 years and I've never felt this way. It might be that I'm not all about the hip new languages, but I don't really see the benefit of making Python more ML/Haskell-ish.

The ML use case for Python is roughly as follows: you design, train, and evaluate models. Then, if something is decent enough to use in production, you switch over your application to load and use that instead. I don't really see where Haskell or any language from the ML family can improve in that process.

Sure, the code that you used to implement your model may improve slightly, but I don't see that code improving significantly. The fruit of your labor is usually a protobuf file (encoding the TensorFlow graph) or whatever your framework uses to encode the model you built. The code actually surrounding it is very minimal for most use cases.

> In Julia, things are really small and composable. For example, you have a probabilistic programming library like Turing and a differentiable programming one like Flux, and it's trivial to implement some Bayesian neural networks.

There's nothing stopping you from composing things in Python. But it's simply not a goal of 99% of ML libraries to be composable with other libraries. You're probably never gonna run TensorFlow and PyTorch in the same application (trust me, I've tried, it was a nightmare) and I don't see why you would compose a TensorFlow model with a PyTorch model without incurring tons of overhead in your application around gluing these two things.

Re:Swift for TensorFlow Shuts Down by socialdemocrat on Friday February 12, 2021 @06:19PM (#26119734)
> There's nothing stopping you from composing things in Python.

There is, and you pointed it out yourself:

> I don't see why you would compose a TensorFlow model with a PyTorch model without incurring tons of overhead in your application around gluing these two things.

This is where Julia is profoundly different. Reusing stuff from different libraries is trivial compared to Python. You could take an activation function made for one libraries use it without any modification or wrapping in another ML library.

These is where Julia will win long term. If you look at the ML libraries in Julia they are tiny. The Python side of things require gargantuan effort because things are not composable. The wheel is reinvented over and over again.

Re:Swift for TensorFlow Shuts Down by amkkma on Friday February 12, 2021 @04:12PM (#26118595)
>there's nothing stopping you from composing things in Python.

In Julia you can compose a custom distribution, with a bayesian model with an ODE with a neural network with unit number types with custom Julia written CUDA kernels and multithreading.

Edit: That are not designed specifically to work with each other

Can python even hope to do a fraction of that, still be fast and differentiate through everything?

Re:Swift for TensorFlow Shuts Down by swagonomixxx on Friday February 12, 2021 @04:27PM (#26118733)
I'm fairly certain everything you said is possible except for custom CUDA kernels in pure Python. You'd have to write the kernel in C++ and use it in your TensorFlow/PyTorch code. [0][1]

[0]: https://www.tensorflow.org/guide/create_op

[1]: https://pytorch.org/tutorials/advanced/cpp_extension.html

Re:Swift for TensorFlow Shuts Down by amkkma on Friday February 12, 2021 @04:41PM (#26118889)
It's definitely not possible. These have to be rewritten with the specific autodiff /ML framework in mind.

Even then, you're not going to have fast custom types to be used on the GPU without dropping into C++

Re:Swift for TensorFlow Shuts Down by swagonomixxx on Friday February 12, 2021 @05:06PM (#26119096)
> It's definitely not possible. These have to be rewritten with the specific autodiff /ML framework in mind.

I don't understand why it's not possible. You're asking if it's possible in the language. I don't see anything stopping you from, as you say, writing your own framework, or simply doing it in TF. Perhaps my ignorance of Julia is showing :)

Re:Swift for TensorFlow Shuts Down by socialdemocrat on Friday February 12, 2021 @06:26PM (#26119793)
Admittedly it is a bit hard to see why Julia is so different in this area if you have not spent some with it. It took me a bit time as well to see.

But there really is a profound difference. The thing is that Python is really just a language to rearrange networks of nodes written in C++. A node written for one ML framework will be incompatible with a node written in another language. If you want them to work together you need to spend a lot of effort gluing them together, and most likely the performance benefits are lost.

This is very different in Julia because you are using pure Julia code. What is specialized C++ nodes in Python, are for the most part just plain functions in Julia. There is nothing special about them. That is why they can be used anywhere.

In Python frameworks each of these C++ nodes need to contain information about how auto-differentiation is done. That is why they are tailor made for one specific ML library.

In Julia the whole automatic differentiation stuff is perform code transformations on regular Julia code.

Are you familiar with LISP, and the idea of code as data? That is what we are talking about here. A regular syntax graph of regular Julia code gets manipulated to do autodiff. You are not organizing C++ nodes in a network.

Re:Swift for TensorFlow Shuts Down by swagonomixxx on Friday February 12, 2021 @06:58PM (#26120073)
> A regular syntax graph of regular Julia code gets manipulated to do autodiff. You are not organizing C++ nodes in a network.

That does sound very different than Python. Admittedly, I haven't used Julia, because I never had to for professional purposes. For personal projects, I use PyTorch, because I find it easy to use, intuitive, and I have a lot of experience with it. Maybe one day I will be forced to use Julia and will appreciate what it brings :)

Re:Swift for TensorFlow Shuts Down by mark_l_watson on Saturday February 13, 2021 @10:11AM (#26124004)
That was a great explanation that makes me appreciate Julia more, thanks.

I don’t much use Julia, but it is a beautiful language. I started a tiny side project for using Julia for non-numerical things like querying SPARQL endpoints, text processing, etc. Julia could be a universal, use for almost everything language.

Re:Swift for TensorFlow Shuts Down by coldtea on Friday February 12, 2021 @07:41PM (#26120382)
>I don't understand why it's not possible. You're asking if it's possible in the language. I don't see anything stopping you from, as you say, writing your own framework, or simply doing it in TF. Perhaps my ignorance of Julia is showing :)

It's not that it's not possible. Yeah, you could always "write your own framework".

It's that it's not readily available by the language, ready-made to compose, without resorting to external libs on C/C++/Fortran, and so on.

So, "not possible" not in the sense that "it's not possible to write a program that solves the halting problem". More like "it's not possible to write a web app in assembly". Which means, yeah, it's possible, technically, but you wouldn't like it, it would be full of holes, a pain to maintain, and not a good time investment.

Re:Swift for TensorFlow Shuts Down by dnautics on Friday February 12, 2021 @07:02PM (#26120118)
Let's say you write some code that handles numbers differently, say a library that implements quaternion math. For doing graphics manipulations. Then you try to use it with tensorflow maybe for some ai-driven optimization. Is it going to work? Probably not out of the box. You will have to do some munging of quaternion data type to shove them into tensorflow tensors. Do the same thing in Julia with Julia's flux, it probably will, and maybe even with the gpu That's the difference.
Re:Swift for TensorFlow Shuts Down by chc on Friday February 12, 2021 @05:21PM (#26119206)
If you're rewriting everything to get the behavior rather than just hooking together preexisting pieces, that's not what's generally meant by composition.
Re:Swift for TensorFlow Shuts Down by mirekrusin on Saturday February 13, 2021 @08:13AM (#26123419)
They key concept that allows for this high degree of composability is multiple dispatch; it’s like if you were able to define trait for any function on any parameter type or to overwrite any existing function to specialise/generalise on one or more parameter types. Ie instead of wrapping different libraries to glue them together to work on your data, you update existing functions to accept your data, ie you blend your thing into existing things instead of wrapping. And once blended your data works not only with that library but also with libraries that use this library without extra effort and with very terse final code.
Re:Swift for TensorFlow Shuts Down by jl2718 on Friday February 12, 2021 @06:32PM (#26119844)
Maybe Numba with Enzyme will catch up to Julia’s features before Julia catches up to Python’s users.

I think the reason why people use python is because it’s the only universally-accepted language for coding interviews.

Re:Swift for TensorFlow Shuts Down by pjmlp on Saturday February 13, 2021 @03:22AM (#26122220)
Only interviews for Python related jobs.

I am not asking anyone to write Python when it isn't part of the job.

Re:Swift for TensorFlow Shuts Down by jl2718 on Tuesday February 23, 2021 @12:34PM (#26240143)
If you are only asking interviewees to demonstrate skills related to the job, it seems like you are deeply in the minority.
Re:Swift for TensorFlow Shuts Down by anon_tor_12345 on Friday February 12, 2021 @06:24PM (#26119782)
It is possible

https://numba.pydata.org/numba-doc/latest/cuda-reference/ker...

which basically calls NVPTX

https://github.com/numba/numba/blob/ec6fa07c12c3703a52c2b4ac...

which is exactly what CUDA does anyway; CUDA code is actually a frontend for an ISA

https://llvm.org/docs/NVPTXUsage.html

Re:Swift for TensorFlow Shuts Down by swagonomixxx on Friday February 12, 2021 @06:53PM (#26120027)
Thanks, I wasn't aware this existed!
Re:Swift for TensorFlow Shuts Down by selectodude on Friday February 12, 2021 @04:28PM (#26118747)
The outcome is more important than the code. While that sounds very elegant, what does it actually add?
Re:Swift for TensorFlow Shuts Down by socialdemocrat on Friday February 12, 2021 @06:33PM (#26119852)
The Julia approach gives quicker development. Some of these ML libraries such as Flux are so small that almost anyone can read the code and learn how it works and make modifications. It is not for anyone to jump into TensorFlow.

The irony here is that tiny Julia libraries give the same power as much larger Python libraries which require highly specialized and trained developers to evolve and maintain.

With Julia it is much easier to grow the eco system because you can make lots of relatively small packages which can then be combined in almost any way.

The challenge for the Julia community today is really to make people new to the environment aware of this.

I have encountered people who thought Flux couldn't do anything because it was so small. He was so used to the huge monolithic libraries in Python, that it did not occur to him that adding something like an new activation function is literally one line of code. He is used to that requiring adding various C++ nodes. Wrap those up and God knows what more steps you need when you extend something like TensorFlow.

I don't think most people realize how powerful Julia is. They are not used to being able to combine libraries the way you can do in Julia. A big part of the effort for the Julia community will simply be to write more tutorial and introduction which better introduce beginners to these kinds of capabilities. Once you know Julia it is pretty obvious.

But grab people's attention and make them realize Julia could be a solution to their problem, I think one needs a lot of sort of shallow and quick intros to these kinds of things.

Re:Swift for TensorFlow Shuts Down by UncleOxidant on Saturday February 13, 2021 @12:09AM (#26121569)
> The challenge for the Julia community today is really to make people new to the environment aware of this.

^This. As we're seeing here in the discussion thread Python folks don't really realize what they're missing when we're talking about composability of of libraries in Julia - it's kind of difficult to explain the impact on productivity without people actually trying it out. I think Julia and Flux are getting to the point where they're quite useable and comparable with PyTorch. Also some of the Neural ODE stuff and differentiable programming in SciML seems just a lot easier to implement than it would be in Python.

Re:Swift for TensorFlow Shuts Down by adgjlsfhk1 on Saturday February 13, 2021 @02:32AM (#26122054)
"I don't think most people realize how powerful Julia isI don't think most people realize how powerful Julia is"

I don't think I realize how powerful Julia is, and it's my main language (and I have written libraries, and contributed to Base).

Re:Swift for TensorFlow Shuts Down by amkkma on Friday February 12, 2021 @04:44PM (#26118912)
https://www.reddit.com/r/Julia/comments/keuumi/bayesian_neur...

See the paper.

It allows for the ecosystem to have a combinatorial explosion of possibilities as each domain expert works on their own package.

I can't foresee every application, but the emergence is the point. This is just a crazy example to show the bounds of what's possible.

Re:Swift for TensorFlow Shuts Down by oivey on Friday February 12, 2021 @07:23PM (#26120248)
From the point of view of a DL researcher, you’re able to easily implement your own custom layers. From the point of view of a framework developer, you get much faster development time. From the point of a more normal user, you hopefully get more features faster because the jobs of the framework developer and DL researcher have been made easier.
Re:Swift for TensorFlow Shuts Down by Karrot_Kream on Friday February 12, 2021 @08:52PM (#26120749)
> I've been using Python for ML for the last 3 years and I've never felt this way. It might be that I'm not all about the hip new languages, but I don't really see the benefit of making Python more ML/Haskell-ish.

Julia is not ML-ish. In fact, at first blush, Julia reads very similarly to Python. You even get list comprehensions in Julia!

> Sure, the code that you used to implement your model may improve slightly, but I don't see that code improving significantly. The fruit of your labor is usually a protobuf file (encoding the TensorFlow graph) or whatever your framework uses to encode the model you built. The code actually surrounding it is very minimal for most use cases.

It's really about breaking down the compositional boundaries here. Upthread, someone talked about how they could play around with Bayesian Nets by simply mixing Flux.jl (the differential programming library) with Turing.jl (the Bayesian programming library). Mixing Tensorflow/PyTorch with PyStan, for example, can be a nightmare. That's also why there's so many implementations of probabilistic programming frameworks (Edward, PyMC3, PyStan, Pyro, etc); they all use different underlying libraries. In Julia they just all compose together.

> I don't see why you would compose a TensorFlow model with a PyTorch model without incurring tons of overhead in your application around gluing these two things

I find the change to be illuminating. Before I started spending more time with Julia, I would often do derivations on paper for more experimental work, and then implement it using TF/PyTorch in Python from scratch, reading other code where I could for some help. In Julia I can import a library and I'm ready to go. It feels just like working with math itself.

Julia also lets you compose long trains of operators together. That also helps when I'm doing long sessions in the REPL exploring data. It lets me define a few functions in a file, import the file, and just pipe (Julia has a pipe operator which is just function application) output between functions to plot data or calculate errors.

Moreover Julia is a lot more performant for REPL work than Python. In Python I'll usually work with a subset of a dataset to get an idea for it, then run a file with code to process the entire dataset. In Julia I can often prototype and run the algorithm in the REPL itself.

I also want to stress that Julia is quite a bit faster for REPL development, both in terms of raw speed

Re:Swift for TensorFlow Shuts Down by ZeroCool2u on Friday February 12, 2021 @04:35PM (#26118826)

  function julia_blues(bummers...)

I largely agree, Julia is such a cool language and had so much potential. It definitely surprised me when they went with Swift instead, but realizing that Chris Lattner worked at Google at the time explained a lot. Unfortunately, every time I try to get into Julia, it just feels awkward coming from Python and a bit like stepping back in time.

The stupidest, (stupidest in the sense that I really wish they didn't bother me, because they're silly things!), things that bother me are:

1. The 'end' keyword. It's everywhere! Loops, if-else statements, function bodies. I mean I understand why it's helpful for parsing and providing more info to the compiler, but honestly, I would've rather we just stuck with curly braces '{}'! At least it's fewer characters to type and it just feels less crowded on screen while reading. It feels like such a petty complaint, but honestly, it feels like I'm writing Pascal or Matlab all over again. Which leads me to my second point.

2. The default choice of 1 based indexing. I'm not going to go into it, because plenty of people before me have beat this dead horse already[1][2][3], but I can't help but be saddened by this choice and its implications. It's important to acknowledge the fact that Julia started as a competitor to Matlab and Octav, so it makes sense from that perspective. However, it could have been a much more general purpose language, with huge performance benefits over popular interpreted languages like Python, JS, and Ruby. It could have been a unifying force in the scientific computing community, bridging the gap between R and Python users with a greenfield approach that would have been a force to be reckoned with. Instead, rightly or not, it's viewed largely as 'just' a matlab replacement.

Now, regardless of whether 1 or 0 based indexing is truly 'better' or the 'end' keyword is no big deal, the reality is that there's a huge demographic of potential users that won't buy into Julia, because it doesn't quite feel as ergonomic as Python/JS/Ruby and won't take it seriously as a general purpose language, because it looks/feels like Matlab and they only use 'real' programming languages. Again, I'm not saying this is right, but it is the reality we're faced with and it just feels like a huge missed opportunity and bums me out.

  end


1. https://github.com/JuliaLang/julia/pull/16260#issuecomment-2... 2. https://groups.google.com/g/julia-dev/c/tNN72FnYbYQ?pli=1 3. https://github.com/julialang/julia/issues/558
Re:Swift for TensorFlow Shuts Down by skohan on Friday February 12, 2021 @04:51PM (#26118970)
Language aesthetics do matter. Broadly it seems like we've accepted that "c like" syntax - including brace-delimited blocks and zero-based indexing - should be the norm for programming languages. Any language which goes in a different direction should have a very strong reason to do so, because any deviation will be an obstacle for adoption.

I share your frustration with the `end` keyword - it's just needlessly verbose, and for something used so frequently it makes sense to be as terse as possible.

I have some similar quibbles with Rust syntax: I know it's a minor issue, but I'm really disappointed that snake_case was adopted. It's just ergonomically inferior to camelCase in every measure. It's one more character to type for every word, and on top of that, on a US keyboard, the underscore character is a pinky key way far away from the center of the keyboard. Making this one of the most frequently typed characters in the language makes no sense.

Re:Swift for TensorFlow Shuts Down by zozbot234 on Friday February 12, 2021 @05:19PM (#26119191)
snake_case is a lot more readable than CamelCase, which is a huge benefit ergonomically. The keyboard layout is no big deal, one can easily change it or use shortcut-based autocomplete. Rust does use CamelCase for type identifiers, trait identifiers and enum constructors, and the contrast with snake_case also aids readability.
Re:Swift for TensorFlow Shuts Down by skohan on Friday February 12, 2021 @05:36PM (#26119350)
I disagree that it's "a lot" more readable. I have read a lot of camelCase code in my lifetime, and I can count on zero hands the number of times I ever had an issue parsing code due to the use of camelCase.

Keyboard remapping seems like an extreme solution, and I don't want to train my fingers in such a way that when I sit down at a different workstation that doesn't have my .vimrc I can't type rust anymore.

You don't need snake_case for contrast. You can use lowerCamel and UpperCamel to denote the same levels of significance. SCREAMING_SNAKE is fine for constants because they don't get used all that often, but rust maps the hardest-to-type case to the most-frequently-used, which in my opinion is an ergonomic failure.

Re:Swift for TensorFlow Shuts Down by ambicapter on Friday February 12, 2021 @11:03PM (#26121295)
CamelCase is terrible as soon as you have an abbreviation in your function (like "DB"). I run into this extremely frequently at my place of work.
Re:Swift for TensorFlow Shuts Down by dragonwriter on Saturday February 13, 2021 @06:44AM (#26123034)
> CamelCase is terrible as soon as you have an abbreviation in your function (like "DB").

Yeah someone always wants to capitalize abbreviations/acronyms weirdly, or treat camel case like it was title case in handling short words or...

Getting people to be consistent with snake case is much easier, for some reason.

Re:Swift for TensorFlow Shuts Down by int_19h on Saturday February 13, 2021 @09:51PM (#26129227)
It really depends on your naming conventions. If you consistently treat acronyms in the same way as regular words (i.e. "XmlReader", "IoStream" etc), then there's no practical difference with "xml_reader" and "io_stream".
Re:Swift for TensorFlow Shuts Down by skohan on Saturday February 13, 2021 @04:53AM (#26122585)
Can you give an example of where you find this "terrible?" I have never had an issue with it, and even if you don't like it aesthetically, I think the fact that you don't like looking at certain names (a subjective complaint) is objectively easier to overcome than being required to type one of the least ergonomic characters on the keyboard over and over, which is a matter of physical reality.
Re:Swift for TensorFlow Shuts Down by timClicks on Friday February 12, 2021 @09:44PM (#26120937)
Sorry to be pedantic, but PascalCase is different from camelCase.
Re:Swift for TensorFlow Shuts Down by kortex on Saturday February 13, 2021 @08:51AM (#26123580)
I use an ergodox keyboard with a custom Dvorak based layout. Underscore is pretty prominent, analogous to the 4 key with no modifiers.

It makes a huge difference, so much so that using camelCase feels like a huge drag.

Qwerty is frankly awful for programming. I encourage everybody to look into alternate layouts.

Re:Swift for TensorFlow Shuts Down by skohan on Saturday February 13, 2021 @11:44AM (#26124614)
So would you seriously suggest that programming languages should be optimized for extremely rare, niche keyboards rather than the standard that ships with virtually every laptop which nearly 100% of coders will be using?
Re:Swift for TensorFlow Shuts Down by detaro on Saturday February 13, 2021 @11:45AM (#26124625)
They are clearly not suggesting that.
Re:Swift for TensorFlow Shuts Down by socialdemocrat on Friday February 12, 2021 @06:40PM (#26119909)
I would argue that `end` is a much better choice than both the Python approach and curly braces: https://erik-engheim.medium.com/the-case-against-curly-brace...

`end` marks of blocks of code much more clearly than curly braces. It is also requires fewer keyboard taps. To type {} requires holding down four keys in total (shift-[ twice). end is just three key strokes.

But more importantly is saves curly braces for other uses where it is more needed.

Re:Swift for TensorFlow Shuts Down by skohan on Friday February 12, 2021 @08:33PM (#26120649)
Typing braces is basically a gesture. You hold the shift key with left pinky, and roll right ring finger pinky over open and close brace, then tap back arrow and return to get you inside the block. End is three distinct key presses.

Also braces have a nice symmetry, which is also convenient for parsers and tooling to count opens and closes.

I also think "end" is just more visually noisy. Braces are a symbol, so it's easy to filter them out when you're looking at code, but a trail of "end"s takes up more real-estate than is semantically justified.

Re:Swift for TensorFlow Shuts Down by eigenspace on Friday February 12, 2021 @07:26PM (#26120267)
Yeah, I'm very glad we saved curly braces for type parameters in julia. I really dislike the use of <these> in static languages.
Re:Swift for TensorFlow Shuts Down by renox on Friday February 12, 2021 @08:41PM (#26120697)
Sigh, <> isn't the only way, D (as usual) has a very simple and clever solution f!(types)(parameter)
Re:Swift for TensorFlow Shuts Down by eigenspace on Friday February 12, 2021 @08:57PM (#26120772)
Maybe it's just my julia indoctrination speaking but I find that rather ugly.

In julia, f!(types)(parameter) means that f! is a mutating function acting on types which returns a closure which is then called on parameter.

We just write Type{paramemer}

Re:Swift for TensorFlow Shuts Down by jodrellblank on Saturday February 13, 2021 @03:59PM (#26126838)
> "We just write Type{paramemer}"

It seems odd to say "we just write" for some arbitrary choice with its own tradeoffs; {} mean a set in Python or a literal array initialiser in C# or a scriptblock in PowerShell or a dfn in Dyalog APL or a JSON dictionary, etc. With only a limited set of whatever symbols happened to end up on a US ASCII keyboard 40+ years ago, there is heavy competition for them, it's why J broke the symmetry of pairs and went for two-character symbols, why PowerShell went for comparators like -gt and -lt, why C# has => which is completely different from <=, why << is not a double application of less-than but is bit shifting ...

To act like there's an objectively better use for {} is to miss how many tradeoffs there are, and how many things people want symbols for out of a standard keyboard.

Re:Swift for TensorFlow Shuts Down by eigenspace on Sunday February 14, 2021 @02:21AM (#26130363)
I never said it was objectively better.

My point was just that we find Type{parameter} to be nice pleasing syntax, and so reserved the curly braces for that.

Of course it’s not objectively better, that’s a dumb attitude towards syntax.

Re:Swift for TensorFlow Shuts Down by skohan on Friday February 12, 2021 @08:34PM (#26120657)
What's the difference to you for using {} vs <>?
Re:Swift for TensorFlow Shuts Down by eigenspace on Friday February 12, 2021 @09:01PM (#26120784)
< and > are comparison operators for checking if something is less than or greater than something else.

This is okay in a static language where there are special slots for a type where only a restricted subset of things can happen. You'd know at the parser level that the < and > are referring to the type meaning or the operator meaning.

In julia, types are values and values can live in types, and arbtrary operations can happen in a type.

E.g. I can write Tuple{1 < 2} which just becomes the type Tuple{true}, i.e. a Tuple Type with paramemter True.

Re:Swift for TensorFlow Shuts Down by skohan on Saturday February 13, 2021 @04:47AM (#26122563)
I feel like this is a solvable problem. For instance you could require parens in the case of expressions using < or > characters.
Re:Swift for TensorFlow Shuts Down by eigenspace on Saturday February 13, 2021 @12:13PM (#26124846)
Or you could just not use them for type parameters. That's also a solution for what it's worth. I think the curly braces look better as type params anyways imo.
Re:Swift for TensorFlow Shuts Down by jodrellblank on Saturday February 13, 2021 @03:26PM (#26126489)
That's not a particularly convincing blogpost - for example you don't need square brackets for indexing, one of Ken Iverson's changes going from APL to J was to see indexing as just another function application and remove square bracket syntax from it. Grouping arithmetic expression is worsened by complex precedence rules, APL always evaluating right-to-left and all operators having the same precendence changes how that works as well (even though it does have grouping parens too). Then complaining that "<>" are used in mathematical expression, but not being annoyed by "main()" in a function declaration or the "?" and ":" used in the complex type expression?

Seems to me that "end" is one of the worse available choices; if we're going for keywords, why not make them "endif", "endfor", "endwhile" (or "wend") which makes it explicitly clear what each of:

        end
      end
    end
is ending.
Re:Swift for TensorFlow Shuts Down by int_19h on Saturday February 13, 2021 @09:54PM (#26129235)
Because it doesn't really help as soon as you get repeated nesting, which isn't all that uncommon.
Re:Swift for TensorFlow Shuts Down by SatvikBeri on Friday February 12, 2021 @05:28PM (#26119266)
I love Julia in general, but yeah, I hate `end`.

Re: 0-indexing vs 1-indexing. If you use 0-indexing, you turn off a lot of non-engineering scientific programmers. My personal experience is that 0-indexing is better for more engineering applications, while 1-indexing is better for math. I'm a weirdo in that I don't seem to mind either one though.

Re:Swift for TensorFlow Shuts Down by cambalache on Friday February 12, 2021 @06:53PM (#26120023)
> you turn off a lot of non-engineering scientific programmers.

I think you mean "non-CS engineers". CS is a minuscule branch of engineering. Plenty of chemical, mechanical, civil (and so on) engineers had their whole education doing maths and programming with 1-indexing.

> I'm a weirdo in that I don't seem to mind either one though.

You are not, as an outsider this is one of the less appealing parts of practical CS, endless bickering about non-substantive issues which most of the time boil down to a matter of personal preference (see also tabs vs spaces, vim vs emacs, react vs vue, golang vs rust and on and on and on...)

Re:Swift for TensorFlow Shuts Down by mjcohen on Friday February 12, 2021 @07:00PM (#26120099)
I don't understand why Julia didn't do like Fortran and Ada and allow any starting index. E.g., a(-5:5, 0:3).
Re:Swift for TensorFlow Shuts Down by kirill5pol on Friday February 12, 2021 @08:32PM (#26120642)
In case you didn’t know, Julia does in fact have arbitrary indexing!

https://docs.julialang.org/en/v1/devdocs/offset-arrays/

Re:Swift for TensorFlow Shuts Down by SatvikBeri on Friday February 12, 2021 @07:16PM (#26120198)
I mean, Julia is flexible enough that it's pretty easy to implement arrays with different indexing schemes that have the same performance as built-in arrays: https://github.com/JuliaArrays/OffsetArrays.jl
Re:Swift for TensorFlow Shuts Down by skohan on Friday February 12, 2021 @05:40PM (#26119385)
Is there an example of where 1 is better for math, or is it just a familiarity thing?
Re:Swift for TensorFlow Shuts Down by FridgeSeal on Friday February 12, 2021 @07:28PM (#26120294)
Zero based indexing came from early requirements to address things in arrays using offsets.

Subsequent languages don’t have this issue, and when you think about it, it causes a weird disconnect: 1-based indexing corresponds exactly with how you think about and see elements in a collection. 0 based indexing-despite how comfortable one gets with it requires additional arithmetic.

It’s a relic from the past, and unless you’re doing the very specific thing of indexing via offset instead of position, there’s no reason to hang onto this anachronism.

Re:Swift for TensorFlow Shuts Down by socialdemocrat on Friday February 12, 2021 @06:44PM (#26119951)
Most math books are written in a way where 1 is the first element. So if you take math examples and translate to code, it works more naturally.

Also this is how you talk normally. You don't talk about the zeroth-column or zeroth-row in daily speech. You talk about first column and first row.

Only reason 0 based indexing make sense to me is because I began programming as a teenagers and was forced to get accustomed to it. But I remember struggling with it. Yes when working with memory, pointers etc it is more elegant. But if you are not, then I think 1-based indexing looks better.

Re:Swift for TensorFlow Shuts Down by SatvikBeri on Friday February 12, 2021 @06:15PM (#26119693)
As a trivial example, if you want to get the sum of the first n numbers, that's `sum(range(n+1))` in Python. Or if you want to get all the prime numbers <= n, find the triangular numbers, etc. In general you end up with a lot of `n+1`s and it's easy to lose track or miss some, and end up with a silent, non-crashing error that produces the wrong result because you're accidentally leaving out the last element of your input.
Re:Swift for TensorFlow Shuts Down by cbkeller on Friday February 12, 2021 @09:13PM (#26120832)
Linear algebra is the most practically consequential one - and suffice it to say, it’s not a coincidence that BLAS, LINPACK, and LAPACK were all written in one-based languages. Matrix indexing is one-based, and beyond the issue of translating notation from equations, IIRC there is even a slight performance difference in some cases.

I believe what it really comes down to is that, just as zero-based really is more natural for offsets (zero offset means the first position, great for pointers), one based really is more natural for counting [and _sets_] (when your index is n that means you have counted n elements up until now).

Re:Swift for TensorFlow Shuts Down by mark_l_watson on Saturday February 13, 2021 @10:21AM (#26124066)
I think your pain points with Julia are real, but they don’t bother me too much. I mostly use Lisp languages, enjoy but am not so good with Haskell, so I am very flexible in syntax. I shared the dislike for 1 based indexing, but when I recently started evaluating Wolfram/One and Language, my limited experience with Julia and Octave made Wolfram’s use of 1 based indexing OK.

I love experimenting with programming languages but I don’t like recommending languages just as I don’t like recommending movies: I figure that everyone has their own tastes, and that is a good thing.

Re:Swift for TensorFlow Shuts Down by adsharma on Friday February 12, 2021 @05:43PM (#26119415)
If it's just the syntax and muscle memory you are quibbling about, you can use python to write code and then transpile it to Julia. Link to github in my other comment in this article.