{"action":"created","issue":{"url":"https://api.github.com/repos/LorenzoBettini/jbase/issues/46","repository_url":"https://api.github.com/repos/LorenzoBettini/jbase","labels_url":"https://api.github.com/repos/LorenzoBettini/jbase/issues/46/labels{/name}","comments_url":"https://api.github.com/repos/LorenzoBettini/jbase/issues/46/comments","events_url":"https://api.github.com/repos/LorenzoBettini/jbase/issues/46/events","html_url":"https://github.com/LorenzoBettini/jbase/issues/46","id":163549184,"number":46,"title":"Are Java bitwise operators possible here?","user":{"login":"tommyettinger","id":160684,"avatar_url":"https://avatars.githubusercontent.com/u/160684?v=3","gravatar_id":"","url":"https://api.github.com/users/tommyettinger","html_url":"https://github.com/tommyettinger","followers_url":"https://api.github.com/users/tommyettinger/followers","following_url":"https://api.github.com/users/tommyettinger/following{/other_user}","gists_url":"https://api.github.com/users/tommyettinger/gists{/gist_id}","starred_url":"https://api.github.com/users/tommyettinger/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tommyettinger/subscriptions","organizations_url":"https://api.github.com/users/tommyettinger/orgs","repos_url":"https://api.github.com/users/tommyettinger/repos","events_url":"https://api.github.com/users/tommyettinger/events{/privacy}","received_events_url":"https://api.github.com/users/tommyettinger/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/LorenzoBettini/jbase/labels/enhancement","name":"enhancement","color":"84b6eb"}],"state":"closed","locked":false,"assignee":{"login":"LorenzoBettini","id":1202254,"avatar_url":"https://avatars.githubusercontent.com/u/1202254?v=3","gravatar_id":"","url":"https://api.github.com/users/LorenzoBettini","html_url":"https://github.com/LorenzoBettini","followers_url":"https://api.github.com/users/LorenzoBettini/followers","following_url":"https://api.github.com/users/LorenzoBettini/following{/other_user}","gists_url":"https://api.github.com/users/LorenzoBettini/gists{/gist_id}","starred_url":"https://api.github.com/users/LorenzoBettini/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/LorenzoBettini/subscriptions","organizations_url":"https://api.github.com/users/LorenzoBettini/orgs","repos_url":"https://api.github.com/users/LorenzoBettini/repos","events_url":"https://api.github.com/users/LorenzoBettini/events{/privacy}","received_events_url":"https://api.github.com/users/LorenzoBettini/received_events","type":"User","site_admin":false},"assignees":[{"login":"LorenzoBettini","id":1202254,"avatar_url":"https://avatars.githubusercontent.com/u/1202254?v=3","gravatar_id":"","url":"https://api.github.com/users/LorenzoBettini","html_url":"https://github.com/LorenzoBettini","followers_url":"https://api.github.com/users/LorenzoBettini/followers","following_url":"https://api.github.com/users/LorenzoBettini/following{/other_user}","gists_url":"https://api.github.com/users/LorenzoBettini/gists{/gist_id}","starred_url":"https://api.github.com/users/LorenzoBettini/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/LorenzoBettini/subscriptions","organizations_url":"https://api.github.com/users/LorenzoBettini/orgs","repos_url":"https://api.github.com/users/LorenzoBettini/repos","events_url":"https://api.github.com/users/LorenzoBettini/events{/privacy}","received_events_url":"https://api.github.com/users/LorenzoBettini/received_events","type":"User","site_admin":false}],"milestone":{"url":"https://api.github.com/repos/LorenzoBettini/jbase/milestones/6","html_url":"https://github.com/LorenzoBettini/jbase/milestones/0.3.1","labels_url":"https://api.github.com/repos/LorenzoBettini/jbase/milestones/6/labels","id":1867179,"number":6,"title":"0.3.1","description":null,"creator":{"login":"LorenzoBettini","id":1202254,"avatar_url":"https://avatars.githubusercontent.com/u/1202254?v=3","gravatar_id":"","url":"https://api.github.com/users/LorenzoBettini","html_url":"https://github.com/LorenzoBettini","followers_url":"https://api.github.com/users/LorenzoBettini/followers","following_url":"https://api.github.com/users/LorenzoBettini/following{/other_user}","gists_url":"https://api.github.com/users/LorenzoBettini/gists{/gist_id}","starred_url":"https://api.github.com/users/LorenzoBettini/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/LorenzoBettini/subscriptions","organizations_url":"https://api.github.com/users/LorenzoBettini/orgs","repos_url":"https://api.github.com/users/LorenzoBettini/repos","events_url":"https://api.github.com/users/LorenzoBettini/events{/privacy}","received_events_url":"https://api.github.com/users/LorenzoBettini/received_events","type":"User","site_admin":false},"open_issues":0,"closed_issues":1,"state":"open","created_at":"2016-07-06T09:39:49Z","updated_at":"2016-07-07T10:10:52Z","due_on":null,"closed_at":null},"comments":5,"created_at":"2016-07-03T06:05:54Z","updated_at":"2016-07-20T23:59:37Z","closed_at":"2016-07-07T10:10:52Z","body":"I realize Xtend seems to frown on bitwise-heavy code, but jbase seems to have Java compatibility as a goal, and that sometimes needs to include bitwise operators. There's relatively-obvious cases like treating 32-bit ints as unsigned by doing `-1 & 0xFFFFFFFFL` to get a long with the correct unsigned value. There's the common use case of `hashCode` implementations using xor. Then there's laughably obscure cases like\r\n\r\n```\r\n        System.out.println(new char[]{\r\n                '$' << (',' ^ '-'), \r\n                '`' | ('-' - '('), \r\n                '$' << (',' ^ '-') | '$', \r\n                '$' << (',' ^ '-') | '$', \r\n                '/' + '@', \r\n                ',', \r\n                ' ', \r\n                '(' + '/', \r\n                '/' + '@', \r\n                '(' + '%' + '%', \r\n                '$' << (',' ^ '-') | '$', \r\n                '*' + ':', \r\n                '!'});\r\n```\r\n\r\nWhich prints `Hello, World!` (without any alphanumeric chars in the text to print) using bitwise ops on `char` literals, something Java allows for some reason. Xbase doesn't define any bitwise operators or even static methods for byte or short values, which is a strange omission (nor does it define them for chars, but that's reasonable). I'm interested in the idea of producing an \"augmented Java\" that could read in normal Java and the augmented dialect with the same compiler/IDE plugin, and Jbase seems like an excellent way to get started with this. Is there any chance of seeing bitwise operators in Jbase, or am I mistaken in assuming they aren't there based on my quick read of the .xtext grammar?"},"comment":{"url":"https://api.github.com/repos/LorenzoBettini/jbase/issues/comments/234119707","html_url":"https://github.com/LorenzoBettini/jbase/issues/46#issuecomment-234119707","issue_url":"https://api.github.com/repos/LorenzoBettini/jbase/issues/46","id":234119707,"user":{"login":"tommyettinger","id":160684,"avatar_url":"https://avatars.githubusercontent.com/u/160684?v=3","gravatar_id":"","url":"https://api.github.com/users/tommyettinger","html_url":"https://github.com/tommyettinger","followers_url":"https://api.github.com/users/tommyettinger/followers","following_url":"https://api.github.com/users/tommyettinger/following{/other_user}","gists_url":"https://api.github.com/users/tommyettinger/gists{/gist_id}","starred_url":"https://api.github.com/users/tommyettinger/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tommyettinger/subscriptions","organizations_url":"https://api.github.com/users/tommyettinger/orgs","repos_url":"https://api.github.com/users/tommyettinger/repos","events_url":"https://api.github.com/users/tommyettinger/events{/privacy}","received_events_url":"https://api.github.com/users/tommyettinger/received_events","type":"User","site_admin":false},"created_at":"2016-07-20T23:59:37Z","updated_at":"2016-07-20T23:59:37Z","body":"I wasn't initially sure, but yes that's right. A single point of extension probably wouldn't be an operator in the normal sense. I've been thinking about this, and I think there's only a few things I really would like to have in a language that Java doesn't quite do currently. Some of them are already in XBase or XTend: extension methods are very useful in the common case of consuming a 3rd-party library but wanting your own additions to it, short ways to produce lambda-like anonymous inner classes on target JDK versions less than Java 8 are important to me, and operator overloading (possibly for new operators using a limited symbol set) is currently part of and, in my opinion, should be part of most languages that add to Java. Some of the features I want aren't adequately supplied by XBase/XTend. There should be a way for user-defined data structures to have a short constructor that assigns values in the constructor (in a strongly-typed manner; I already have functions that can do this, though with almost no type-checking and not in a very concise way, on Map constructors, but it's possible for the compiler to ensure a Map<K, V> constructor is given alternating K and V arguments). I think there should be some kind of better approach to the simple cases of macros (possibly even as simple as word/phrase/regex substitution, as long as the replacement has a stable type that the compiler can check in the IDE) than the massive and heavyweight approach of active annotations. The last one might slip too much into the category of term-rewriting instead of macros, and could need restrictions to avoid infinite-replacement-loop issues if the replacement, for instance, was part-way written and replaced \"term1\" with \"(term1 + term1)\" (it's even the same type signature, as long as what addition returns is the same type as its operands). I think the last problem could be solved by always using macros by their name, never replacing unrelated code in a simple textual manner (though macros should be able to take arguments, which would be considered related code and be next to the name), having all macro names be out-of-scope or non-generated in the Java code, and having a macro's name not be visible within its own body (preventing macro recursion, and in a roundabout way also preventing mutual macro recursion).\r\n\r\nThe reason I'm mentioning this here is because I like the syntax JBase uses more than XBase/XTend's syntax (and I agree with the reasonable choice to use Java's behavior where a feature exists instead of inventing something new, like unrequested implicit List-to-array conversion). I think I'm a long way off from actually implementing this, especially since I've disabled the IntelliJ XText plugins since they were interfering with debugging in all projects, and not just XText ones. I also want to have some kind of standard library ready near the start of language development (starting in Java, but if the plan holds up I should be able to switch to using an extension of JBase).\r\n\r\nThanks for getting back to me on this, by the way. I'll keep these resources in mind when I start implementing."}}
{"actor":{"display_login":"tommyettinger"}}