-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow $$
$+
$*
$/
$$=
$+=
..=
as operators in the parser
#11102
Conversation
these operators are already taken as the interpolation symbol |
@vtnash, that's not correct. Outside of a string literal, $ is used for bitwise XOR, and has nothing at all to do with string interpolation. None of the combinations I added were even being parsed in Julia as operators... that is what this change accomplishes, so that somebody could use any of them, if they so wished, in a package. |
they parse for me as existing syntax:
although true that they aren't valid as infix operators, there is a duality of all operators in julia such that I'm also pretty opposed to adding new operators to the language (ala http://en.wikipedia.org/wiki/APL_%28programming_language%29) |
@vtjnash That's not what I got... isn't the quote similar to having them in a """, where you'd expect interpolation?
I also, as you can see, was able to edit the Scheme parser and make these all work as infix operators |
no, please read http://docs.julialang.org/en/latest/manual/metaprogramming/ |
@vtjnash Yes, I read that... but it's not quite clear that that precludes using |
@vtjnash That's a coincidence! I actually just read that yesterday! I had to do some APL programming as part of a course at MIT back 34 years ago, and after seeing the HUGE number of operators defined by the parse in Julia, I went back and Google'd APL...
I think the proverbial horse left the barn many ages ago in Julia! |
@vtjnash I really don't think your objection holds, about
|
perhaps, but
yes, i object to adding more unique ascii character sequences to the list. i'm largely ambivalent on the unicode operators: they are harder to google directly, but if you already know what they are (or can lookup their unicode name), they can make an algorithm much more readable. |
An awful lot of people work with strings and databases, and there doesn't seem to be a lot of demand from them for Granted, all the unicode operators are kind of ridiculous, but consider (1) many of them are very standard math symbols like set operators, (2) there is nothing else they could possibly mean. I doubt I'm ever going to use "⋨", but why not parse it as an operator? Allowing that as an operator in no way implies allowing arbitrarily more ASCII sequences as operators. You have to allocate your ASCII very carefully. To gain some idea of the enormity of this, take a look at https://www.python.org/dev/peps/pep-0465/, which is what numeric python users went through to get a single operator added to the language, after years. In nested Since we parse |
@JeffBezanson There are all sorts of databases... People working with SQL databases, or modern document databases, really wouldn't be using that sort of a slice operator (you were talking about just $/ there, right? To take a string and a character, or a string and a string, and return an array or tuple of substrings... The thing is, those aren't the only sorts of databases... I also understand totally about the issues of language design... did that for many years... and allocating ASCII characters very carefully... but I do wish that that care had actually been taken with Julia... I wasn't aware of using So, given the problems that I hadn't been aware about with using Thanks very much for the help! |
Maybe it's best to consider this pull request a WIP that people can try out and experiment with if they like for now. If it's not going to be merged for a while, I think it would be premature to take out those operators. It's true that those character sequences already have a use, but I think eg If we would settle for one of these for string concatenation, I don't think many would fall into the trap of writing I'm quite sure that the lexer has no trouble to distinguish |
Ok, so you think we have used our ASCII poorly. I'm sorry to hear that. But how is the situation improved by adding a random spray of extra operators? I don't get it. The argument seems to be that the more mis-allocated syntax we already have, the more it should be ok to add? Whether I think |
@ScottPJones the |
Devil's advocate, you didn't ask me, etc... Given that only a subset of users of Julia will ever use that application-dependent meaning of |
@JeffBezanson "a random spray of extra operators"? I'm sorry, but as I tried to make very clear, unlike the random spray of 100s of operators that the parser already does handle... I intended for these to be a logically consistent, small set of operators... where |
@jiahao 1) Is the |
@tkelman 👍 💯 Precisely the point I was trying to make all along (but much better explained!) |
Is the documentation not clear about this? If it isn't, we should improve the documentation. Matrix multiplication and elementwise multiplication are distinct operations, and pep 465 tells the story of what happens when you would like to do linear algebra without having distinct operators for the two. |
@tkelman would there be any chance of getting DataFrames to change to make the ~ formulas have to go in a macro? There have been much larger breaking changes to the language in just the few weeks I have been using the language... (Tupocalypse, for one!) |
I'm not the person to ask. There is some history of having to quote the |
@tkelman I must have misunderstood some threads about trying to get people to use the |
If we decided that FWIW, |
@nalimilan What happens when you might need it for something else? My point is, it is not a good idea for packages to be written in ways that preclude changes to the base language, or preclude other packages from using syntax that would be natural for them... I think @tkelman's comments were right on, about how JuMP handles things without causing problems elsewhere (except for the use of |
@nalimilan I would have thought that the syntax: |
I agree wholeheartedly with @toivoh 's comments... much better said than I've been able to. |
these operators are already taken by the language. parsing them differently is a breaking change.
The module system in Julia means that nothing else will disturb DataFrame's usage of |
That may be the case - but there are no unit tests or anything apparently for that sort of syntax, Also, I'd agree with @toivoh, that it really is not that big of a burden to make people use |
@JeffBezanson If I removed all the other operators, and just added
The reason I want at least some operator and corresponding assignment operator, is to be able to write a string package, utilizing all of my performance ideas, with both fast immutable and mutable strings, Does that make sense to people? |
@StefanKarpinski For |
I don't think changing the encoding of an object is going to have the performance that you might hope. |
IIRC @vtjnash usually posts from a phone, so he may come across as overly concise. Erring on the side of conciseness is not a bad idea though. If someone wants you to elaborate they can ask you to elaborate. FAR too much bandwidth has been spent on string concatenation and related topics in the last few weeks. You're absolutely right about documentation leaving a lot to be desired, and we appreciate the help in making it better. Inconsistencies in base Julia's handling of null termination and encoding validity checks can be addressed one specific item at a time. But as far as major new features like mutable strings, everyone will be much happier if you first pursue development of a package outside of base Julia, where design and API decisions can be done independently as you see fit. If you announce the under-development package on the mailing list then people who are especially interested in string processing can follow along and contribute to the development. Before even coming up with a working proof of concept, you're not likely to convince the core team that these are things we absolutely need or want as part of the core language. "Better strings" sounds great in theory, but if it comes at the cost of two dozen more conversations like this one, no one has the patience for that. |
@ScottPJones, I think what @vtjnash is getting at is that you should endeavor to increase the ratio of code and research to commentary. You've managed to make it into the top 30 posters by volume on this repository in a few short weeks, outpacing many who have been regular, productive contributors for years. At this rate, you will have written more commentary on the repo than anyone else, including me, by end of year. I'm the current champion blabbermouth, but I've been at this for a while, and your rate dwarfs mine (I've also committed a bit more code). That rate is more than a little taxing to keep up with – I have mostly stopped reading your posts due to their volume, to be honest. Don't get me wrong – your enthusiasm and improvements are greatly appreciated – but please keep the comments more concise. |
I want to highlight @tkelman 's suggestion to deal with issues one small item at a time. It is not efficient to reserve bug reports for when you happen to need ammunition for talking about how inconsistent julia is. Instead of writing lengthy diatribes about how awful we are, please just open an issue for each small item, with 1-2 sentences saying what the problem is (e.g. "ascii and utf8 do not have the same methods as utf16 and utf32") and maybe giving an example if appropriate. Then we can just go through the bugs one by one. At peak rate, I've been known to close 5 or more bugs in a day, so things really can improve this way. |
Yes, those are great issues – thank you for posting them. |
@tkelman I'm sorry, but I felt @vtjnash's comment went a bit far, since it was his suggestion in the first place... I had intended to research the way
@StefanKarpinski Although nobody here seems to believe it, I do have some small experience with these matters, and know pretty well what performance I will see, having done so in the past, and having had decades of benchmarks that showed, at least with the applications of our customers, that my approaches got very good results. Hopefully I'll have time with Julia to be able to show you. @JeffBezanson Please! That's pretty bad to say I "reserve bug reports for when you happen to need ammuntion"... That's also wrong and insulting, and also shows you didn't pay attention to my "diatribe". I said that I discovered those just then, doing the research that @vtjnash had made a snide remark about... and I immediately created small issues, as I'd been told is the better way to do things... (I actually am able to learn new stuff, BTW). I've also not be creating bug reports willy-nilly... Sorry for the long-winded response... but I felt it had to be said... |
@ScottPJones Come on man, nobody is insulting anyone. People are just trying to gently nudge you into the style of comment/contribution which is appreciated here : mostly technical, short and to the point. If you feel the forms are missing sometimes it's because there is no need for it, everyone is implicitly assumed to be friendly and with good intentions. We are not many having the opportunity to spend time working on the project so we do value this time. |
@carnaval Sorry, but having somebody accuse me of holding back bug reports, or saying "how awful" people are, when it is totally false, does feel rather insulting and defamatory... and is not doing me the favor of implicitly assuming me to be friendly and with good intentions... (which I am!) I also value my time, and have just been trying to work out issues that caused problems in my wanting to use Julia on a project... I hope we'll be able to (although the tuplecalypse has killed off our plan of using Julia + ODBC.jl... too much time spent trying to figure out why it was broken in 0.4... so that developer has sadly decided to go back to Python...) |
This is not an attack on your knowledge, abilities or intentions. It is a request: please keep your messages shorter, fewer, and more to the point. |
@ScottPJones no offense intended in my comment above. as Stefan mentioned above, your replies sometimes get quite long, so reading them thoroughly takes time that most would rather be spending doing their own work. consequently, I am suggesting that waiting to post until you have a more complete story is likely to be a better use of everyone's time (including your own). conciseness and completeness will be highly valued by your readers. reporting issues is great, even ones that just point out API inconsistencies. but talking about them in unrelated threads is unlikely to ever be appropriate. it's frustrating to other developers to be browsing for updates to a topic and instead be wading through unrelated commentary. (and as you've unwittingly discovered now, it seems to have become one of Jeff's personal pet peeves).
well, to be fair, he wrote that code several years prior to the existence of Julia :) |
OK, what about adding one of the following characters as a generic concatenation operator (or do these also have some mathematical meaning that is used elsewhere that needs to be preserved [although, given that |
No, that is the direct sum symbol and it's is used in mathematics all the time. |
Well, so is |
@StefanKarpinski If you are think that the |
@ScottPJones I don't know if you are aware but most of your comments ooze with passive aggressiveness. It has gotten to the point where I basically stop updating myself on the newest issues because I cringe so much. It is really frustrating... |
@KristofferC No - I'm not aware of just what is bothering you. I've been trying to get something done so that I could add something I considered important to Julia that was missing, namely a generic concatention operator (and possibly a corresponding assignment operator). So far, every possibility I've raised has been shot down, for one reason or another, the latest being:
I tried to point out that that reason was not at all consistent with the idea that I'd appreciate some suggestions as to what might be acceptable for operators, that don't already have a well known use on vectors or matrices (I'd only seen circled plus for XOR before, but since it does have a meaning for vectors, even if it isn't currently implemented in Julia, I wouldn't want to use it), and preferable a symbol that might make somebody think of addition or concatenation. You could always unsubscribe to the PRs and Issues that I create, if they bother you so much. If you'd like to tell me just what I'm doing wrong in my messages, please do (but by private e-mail, so you don't end up aggravating the other people following these issues I've been raising). I'd appreciate it, because I really don't want to aggravate anybody, I'm trying as best I can to adapt myself to working well within this community, and if you'd read all my messages, I'd think you'd find I've been very appreciative of all the people who have donated their time answering my questions, reviewing my PRs, and pushing me to be a much better Julia programmer, and I've been gushingly complementary of the great work the contributors have accomplished. |
⊕ is in the operator table Line 16 in 01abdc3
|
I should have been clearer, it is N-ary circled plus, |
Also, neither is in the shortcuts either, making them not very usable. |
What do you mean by shortcut?
|
OK... well, that's rather inconsistent! Why are those
Thanks very much for the information! julia> a ⨁ b
ERROR: syntax: extra token "⨁" after end of expression
julia> a ⊕ b
ERROR: UndefVarError: ⊕ not defined |
Well, for the inconsistency, you'd better blame whoever come up with the names in latex |
This PR is about adding more operators to the parser. Changing the string concat operator should be another issue. @ScottPJones My 2 cents RE noise/passive aggressiveness: remember on the internet no-one can hear your tone so additional care should be taken to not sound like an ass. If you feel wronged by whatever was said by someone else (if they sounded like an ass), remember it probably wasn't meant as a slight (everyone here is just doing their best to improve julia).... so never escalate and never call people out for slights against you personally. In this case, some feedback from several core julia devs was "be more concise"... two of your next posts were screen-long. So I think some reflection on your part would be worthwhile. |
@yuyichao Thanks for that information - I didn't know where the shortcuts came from originally. |
@ScottPJones since it sounds like you're not very familiar with LaTeX, just FYI the convention with |
Thanks for the info! Like my limited knowledge of linear algebra, my knowledge of Latex dates back over 30 years, and nothing since. |
This simply defines them so that people can easily play around with different syntax for string concatenation and general abstract vector concatenation, in the hope of coming to some better consensus. I believe this should have absolutely no affect on any current Julia programs.