Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Post
  • Reply
fart simpson
Jul 2, 2005

DEATH TO AMERICA
:xickos:

Notorious b.s.d. posted:

we'll see

it has only existed for a couple of years, so most of the potential users haven't started using it yet. there is nothing fundamentally wrong with the api. it might work out really well

anything that stops people from using jelly has to be a good thing:
XML code:
<JiraJelly xmlns:jira="jelly:com.atlassian.jira.jelly.enterprise.JiraTagLib" 
           xmlns:j="jelly:core" 
           xmlns:util="jelly:util">
<j:invokeStatic className="com.opensymphony.user.UserManager" method="getInstance" var="instance"/>
<j:invoke on="${instance}" method="getGroup" var="grp">
<j:arg type="java.lang.String" value="thegroupname"/>
</j:invoke>
<j:invoke on="${grp}" method="getUsers" var="users"/>
</JiraJelly>

i got to

quote:

Jelly is a tool for turning XML into executable code.
and stopped reading

Adbot
ADBOT LOVES YOU

Notorious b.s.d.
Jan 25, 2003

by Reene

Shaggar posted:

if you're talking simple scripts they wouldn't be different enough to matter and if you're talking about doing real interop (like defining java classes in the script) then obviously knowing java is probably pretty critical to that
jsr 223 languages can't define java classes. it's very much one-way interop, so you can script java stuff w/ js or similar

Shaggar posted:

like idk what scenario would exist where i'd want someone who knows javascript but not java writing a thing in my java environment.
nothing wrong with someone making use of the tools and poo poo you already wrote using a lower barrier-to-entry language

you could configure stuff with a js program instead of a complex config file.
or have an interactive repl for config/scripting

lots of things could be done, just they'll be different from how we do them now

Notorious b.s.d.
Jan 25, 2003

by Reene

Posting Principle posted:

oh my god what its cf but worse

it's so, so, so much worse.

jelly is basically a framework for making your own CF-like language.

it presents the opportunity combine the worst kind of masturbatory DSL bullshit with XML hell

fart simpson
Jul 2, 2005

DEATH TO AMERICA
:xickos:

who the hell uses "jelly"? how could anyone see that and think yeah i'll have a bit of that

skeevy achievements
Feb 25, 2008

by merry exmarx

Notorious b.s.d. posted:

the crappiness of clojure java interop has been addressed like three times in the past ten pages i'm gonna leave this one alone

I'm legit interested and there's only 2 mentions of clojure in the past 20 pages before I brought it up and yeah it's sad that I actually went an dlooked

Nomnom Cookie
Aug 30, 2009



it's not that hard to combine java's xml parsing and reflection to create "executable xml". ofc the next step is to make your config files use this format, because what is a config file but instructions in a very specialized programming language. might as well just use java!

afaik this is how tomcat and jetty's config formats were born and apparently this jelly poo poo as well

Nomnom Cookie
Aug 30, 2009



jsr 223 doesn't mandate javascript just that conforming implementations ship some kind of scripting language. so you can't actually rely on anything about jsr 223 without either dropping portability or bundling your own interpreter

Dessert Rose
May 17, 2004

awoken in control of a lucid deep dream...

MononcQc posted:

I can't ever imagine having fun programming through XML :smith:

people seem to really want to do it, though

X-BUM-RAIDER-X
May 7, 2008
who ever reads or edits config files anyway

MononcQc
May 29, 2007

In some open space startup office in the bay area

- I'm so annoyed by the boss always wanting to tweak lovely useless things! That's interrupting me! How can I ever be a 10x engineer if I keep getting interrupted?

- Agreed! As a fellow 10x Engineer, I say let's make the program use a configuration file so that people can change the software's behavior without changing code!

- Alright let's get started.

both employees furiously share the same keyboard and type at light speed for 30 minutes. the feathers on their fedoras are moving through the wind created by their nimble fingers' movements

- Hrm, this here value is configurable the way I want, but what if I want to do this instead?

the developer points at screen, leaving a greasy cheeto-orange fingermark

- Oh right. The config file needs to be more flexible then

- Yeah, let's make it a DSL that way managers can get it too

- That's brilliant! that way we can just show them how to edit the file and we don't have to work anymore -- we can just browse mensright on reddit and be the coolest dudes around

both employees spend 17 additional hours programming, drinking Monster energy drinks and actively avoiding showers and other hygienic measures

- There, done! We should never have to touch that software again. The DSL is so flexible it's probably Turing complete.

- It's a beauty. No time for documentation, let's deploy it right away

the manager never touches the configuration file because it's too complex and he doesn't give a poo poo about it. He just keeps asking devs to do all the changes for him in it for whatever change is needed ever after. Developers gradually end up moving most of the system to their invented lovely in-house ad-hoc programming language they wrote to not have to program.

MononcQc fucked around with this message at 20:19 on Oct 3, 2013

Dessert Rose
May 17, 2004

awoken in control of a lucid deep dream...
fogbugz makes a lot of sense now

Notorious b.s.d.
Jan 25, 2003

by Reene

Nomnom Cookie posted:

afaik this is how tomcat and jetty's config formats were born and apparently this jelly poo poo as well

tomcat not really
jelly yes
jetty yes

  • almost all tomcat configs really are a document, it's all declarative and pretty reasonable.

  • jelly's core is a transliteration of java to xml. it permits you to add hairy nasty coldfusion-type poo poo. it is pure loving evil that needs to die.

  • jetty started out with java procedural config, and they made the xml resemble the java calls and it just sucks. i don't think you can even validate the xml. always use the java interface.

Notorious b.s.d.
Jan 25, 2003

by Reene

Nomnom Cookie posted:

jsr 223 doesn't mandate javascript just that conforming implementations ship some kind of scripting language. so you can't actually rely on anything about jsr 223 without either dropping portability or bundling your own interpreter

jsr 223 doesn't require you to bundle anything, but oracle is choosing to bundle javascript, and their javascript engine is open source. every j2se implementation will probably include it because it would be stupid not to

technically a ton of poo poo everyone relies on isn't part of the java standard. this is why there is a distinction between openjdk and icedtea. openjdk is just barely enough to pass a tck. icedtea adds a bunch of other poo poo that you expect to find in j2se that isn't actually mandated by the tck

Notorious b.s.d.
Jan 25, 2003

by Reene

Internaut! posted:

I'm legit interested and there's only 2 mentions of clojure in the past 20 pages before I brought it up and yeah it's sad that I actually went an dlooked

it's pretty simple.

clojure provides nasty hairy tools to call to/from java: proxy, reify, doto, and worst of all, motherfuckin type hinting to make sure you don't spend all day waiting on reflection

scala provides nothing. you don't need anything. scala classes are java classes, with type data java understands. scala methods are java methods. calling java from scala or scala from java is totally seamless

Nomnom Cookie
Aug 30, 2009



it's hard or maybe impossible for java to consume an idiomatic scala api because of things like lambda params. so it's not seamless imo

still much simpler than clojure

Soricidus
Oct 21, 2010
freedom-hating statist shill
i use jython 2.7 for all my jvm scripting needs. its pretty good if you want to combine the robustness and raw performance of python, the terse expressiveness of java apis, and the proven reliability of beta software

do we have this driving mission-critical production code? i'll leave that to your imagination!

trex eaterofcadrs
Jun 17, 2005
My lack of understanding is only exceeded by my lack of concern.
clojure just calls java code
code:

(.getName (File. "yourgay.txt"))
i can see how if you needed to go backwards and use java on clojure objects it would be annoying, but it really isn't that annoying and you probably won't actually do that in real life, cause clojure just works ™

Notorious b.s.d.
Jan 25, 2003

by Reene

trex eaterofcadrs posted:

clojure just calls java code
code:

(.getName (File. "yourgay.txt"))
i can see how if you needed to go backwards and use java on clojure objects it would be annoying, but it really isn't that annoying and you probably won't actually do that in real life, cause clojure just works ™

yes if I treat clojure as a dumb jsr 223 scripting language everything works within that limited problem space

but many people want more interop than that. e.g. Writing libraries in a language no one outside your team can use is very limiting unless you have the seamless interop

trex eaterofcadrs
Jun 17, 2005
My lack of understanding is only exceeded by my lack of concern.
or if you treat clojure as the lingua franca of your project and only use java for the ecosystem/libs or if you need to for whatever reason

coffeetable
Feb 5, 2006

TELL ME AGAIN HOW GREAT BRITAIN WOULD BE IF IT WAS RULED BY THE MERCILESS JACKBOOT OF PRINCE CHARLES

YES I DO TALK TO PLANTS ACTUALLY
playing with the thrust CUDA library right now

code:
#include <thrust/host_vector.h>
#include <thrust/device_vector.h>
#include <thrust/generate.h>
#include <thrust/sort.h>
#include <thrust/copy.h>

#include <boost/format.hpp>
#include <ctime>

int main()
{
	std::cout << "Generating randoms..." << std::endl;
	thrust::host_vector<int> h_vec(pow(2, 26));
	thrust::generate(h_vec.begin(), h_vec.end(), rand);

	std::cout << "Transferring to device..." << std::endl;
	thrust::device_vector<int> d_vec = h_vec;
	
	std::cout << "Sorting..." << std::endl;
	auto start = std::clock();
	thrust::sort(d_vec.begin(), d_vec.end());
	double duration = (std::clock() - start) / static_cast<double>(CLOCKS_PER_SEC);

	std::cout << "Transferring back..." << std::endl;
	thrust::copy(d_vec.begin(), d_vec.end(), h_vec.begin());
	
	std::cout << boost::format("Sort runtime: %1%") %  duration << std::endl;
}
64 million random integers sorted in 800ms and thirty lines of code. owns owns owns

coffeetable fucked around with this message at 03:03 on Oct 4, 2013

compuserved
Mar 20, 2006

Nap Ghost

coffeetable posted:

playing with the thrust CUDA library right now

code:

#include <thrust/host_vector.h>
#include <thrust/device_vector.h>
#include <thrust/generate.h>
#include <thrust/sort.h>
#include <thrust/copy.h>

#include <boost/format.hpp>
#include <ctime>

int main()
{
	std::cout << "Generating randoms..." << std::endl;
	thrust::host_vector<int> h_vec(pow(2, 26));
	thrust::generate(h_vec.begin(), h_vec.end(), rand);

	std::cout << "Transferring to device..." << std::endl;
	thrust::device_vector<int> d_vec = h_vec;
	
	std::cout << "Sorting..." << std::endl;
	auto start = std::clock();
	thrust::sort(d_vec.begin(), d_vec.end());
	double duration = (std::clock() - start) / static_cast<double>(CLOCKS_PER_SEC);

	std::cout << "Transferring back..." << std::endl;
	thrust::copy(d_vec.begin(), d_vec.end(), h_vec.begin());
	
	std::cout << boost::format("Sort runtime: %1%") %  duration << std::endl;
}

64 million random integers sorted in 800ms and thirty lines of code. owns owns owns

CUDA is p boss

Notorious b.s.d.
Jan 25, 2003

by Reene

trex eaterofcadrs posted:

or if you treat clojure as the lingua franca of your project and only use java for the ecosystem/libs or if you need to for whatever reason

right, i think it is obvious that if your project uses clojure as the lingua franca and default choice, you will have a much better clojure experience

this is however an impossible barrier to entry for millions of java developers. seamless interop ensures that scala doesn't have this problem, so scala is getting commercial traction in a way that clojure is not.

Notorious b.s.d.
Jan 25, 2003

by Reene

coffeetable posted:

playing with the thrust CUDA library right now

code:
#include <thrust/host_vector.h>
#include <thrust/device_vector.h>
#include <thrust/generate.h>
#include <thrust/sort.h>
#include <thrust/copy.h>

#include <boost/format.hpp>
#include <ctime>

int main()
{
	std::cout << "Generating randoms..." << std::endl;
	thrust::host_vector<int> h_vec(pow(2, 26));
	thrust::generate(h_vec.begin(), h_vec.end(), rand);

	std::cout << "Transferring to device..." << std::endl;
	thrust::device_vector<int> d_vec = h_vec;
	
	std::cout << "Sorting..." << std::endl;
	auto start = std::clock();
	thrust::sort(d_vec.begin(), d_vec.end());
	double duration = (std::clock() - start) / static_cast<double>(CLOCKS_PER_SEC);

	std::cout << "Transferring back..." << std::endl;
	thrust::copy(d_vec.begin(), d_vec.end(), h_vec.begin());
	
	std::cout << boost::format("Sort runtime: %1%") %  duration << std::endl;
}

this almost excuses the use of c++ holy crap i never thought gpu programming would be that easy

Notorious b.s.d.
Jan 25, 2003

by Reene

Nomnom Cookie posted:

it's hard or maybe impossible for java to consume an idiomatic scala api because of things like lambda params. so it's not seamless imo

so i actually just investigated the lambda param thing, and it is actually feasible (albeit really ugly) to instantiate scala.Function1 in java and pass a function to your scala code

stack overflow had a workable solution:
Java code:
final Function1<Integer, String> f = new Function1<Integer, String>() {
    public int $tag() {
        return Function1$class.$tag(this);
    }

    public <A> Function1<A, String> compose(Function1<A, Integer> f) {
        return Function1$class.compose(this, f);
    }

    public String apply(Integer someInt) {
        return myFunc(someInt);
    }
};
MyScala.setFunc(f);
this is loving terribly ugly but it looks doable

in java 8 it could be enhanced by having a Function1 constructor that takes a java-ized lambda as an argument, or even replacing the scala Function* suite of classes with java-lambdas

Nomnom Cookie
Aug 30, 2009



$ isn't legal in an identifier though?

Notorious b.s.d.
Jan 25, 2003

by Reene

Nomnom Cookie posted:

$ isn't legal in an identifier though?

it isn't?

it compiles and produces a class file with the right stuff in it per 'javap'

Notorious b.s.d.
Jan 25, 2003

by Reene
here is a blog comment with a less-loving-terrible mode of doing this

at heart scala lambdas and java lambdas are both anonymous inner classes inside of the compiled bytecode, so there's no reason they can't have pretty reasonable interoperability:

Daniel Spiewak posted:

Yeah, Scala function values in Java are nightmarish.

One thing that can be done to improve that is define utility methods and Java interfaces to abstract out most of the boilerplate. Like so:
Java code:
public interface JFunction0<R> {
    public R apply();
}

public class FunUtils {
    public static <R> Function0<R> fun(final JFunction0<R> f) {
        return new Function0<R>() {
            public int $tag() {
                return Function0$class.$tag();
            }

            public R apply() {
                f.apply();
            }
        };
    }

    // etc...
}
With this, you can define Scala functions from Java like so:
Java code:
Function0<String> f = fun(new JFunction0<String>() {
    public String apply() {
        return "Hello, World!";
    }
});
Better, but still pretty ugly.

Actually, I think that a lot of the pain comes from the fact that Scala requires the $tag method. The good news is that this method is in candidacy for removal. It was an optimization back in the day, but it has been discovered that the JVM is pretty efficient with a large string of instanceof checks, so it may not really be necessary anymore.

Workaday Wizard
Oct 23, 2009

by Pragmatica
why doesn't this work in python

Python code:
while (mathzzz = somefunc()) >= 0:

Shaggar
Apr 26, 2006
heres the solution to scala problems: stop using scala

FamDav
Mar 29, 2008

Shinku ABOOKEN posted:

why doesn't this work in python

Python code:
while (mathzzz = somefunc()) >= 0:

what do you think that should do

Workaday Wizard
Oct 23, 2009

by Pragmatica

FamDav posted:

what do you think that should do

i think there is no reason assignment is not considered an expression


is there?

e: specifically it should return the left hand side of the assignment

FamDav
Mar 29, 2008

Shinku ABOOKEN posted:

i think there is no reason assignment is not considered an expression


is there?

e: specifically it should return the left hand side of the assignment

assignment is an expression, which is why the while loop can use it as a test condition

FamDav
Mar 29, 2008
what should the while loop evaluate to?

FamDav
Mar 29, 2008
RINGDINGDINGIDNGINDGINDG RINGIDNGINDINDGINDGINDGDG

WAPAPAPAPAPAPAAPOW WAPAPAPAPAPAPAPAOW

Workaday Wizard
Oct 23, 2009

by Pragmatica

FamDav posted:

assignment is an expression, which is why the while loop can use it as a test condition

actually it can't thats the problem

Python code:
>>> while (p = m.find('BM')) >= 0:
	
SyntaxError: invalid syntax

Posting Principle
Dec 10, 2011

by Ralp

FamDav posted:

RINGDINGDINGIDNGINDGINDG RINGIDNGINDINDGINDGINDGDG

WAPAPAPAPAPAPAAPOW WAPAPAPAPAPAPAPAOW

Workaday Wizard
Oct 23, 2009

by Pragmatica
i found the reason and it's some weak poo poo

"oh no some dumbass might not be able to tell assignemnt from equality let's have the users repeat themselves in a more bug prone way that sure is better yessirreee"

FamDav
Mar 29, 2008

Shinku ABOOKEN posted:

i found the reason and it's some weak poo poo

"oh no some dumbass might not be able to tell assignemnt from equality let's have the users repeat themselves in a more bug prone way that sure is better yessirreee"

oh sorry i misunderstood you because i was thinkin mandatory parens around the boolean. my b

also python makes decisions on some groundball poo poo. gently caress you guido

FamDav
Mar 29, 2008
you know how you fix that error?

while (0 = x) // oh no i cants assign to this young constant what do i do?????

Adbot
ADBOT LOVES YOU

kitten emergency
Jan 13, 2008

get meow this wack-ass crystal prison
assignment != equality is really hard guys









if you're in cs101

  • 1
  • 2
  • 3
  • 4
  • 5
  • Post
  • Reply