New around here? Register your SA Forums Account here!

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
CPColin
Sep 9, 2003

Big ol' smile.

CRIP EATIN BREAD posted:

make sure to add -Xjsr305=strict to your compiler config if you haven't. this will make sure that annotation based nullability annotations will cause compilation errors instead of warnings

Yeah, that was one of the first things I did. A little boilerplate-y, but at least I only have to add it to build.gradle.kts once and never have to think about it again (until I make a new project).

Adbot
ADBOT LOVES YOU

Finster Dexter
Oct 20, 2014

Beyond is Finster's mad vision of Earth transformed.
I thought kotlin basically was java

DONT THREAD ON ME
Oct 1, 2002

by Nyc_Tattoo
Floss Finder
scala is the same. you have to do a little more work to make your scala libs work in java but in practice you rarely need to do this and if you’re doing it a lot then write the libs in java instead.


DONT THREAD ON ME fucked around with this message at 19:40 on Jun 6, 2019

CRIP EATIN BREAD
Jun 24, 2002

Hey stop worrying bout my acting bitch, and worry about your WACK ass music. In the mean time... Eat a hot bowl of Dicks! Ice T



Soiled Meat
sorta is but it has a lot of happy things to make your life easier. plus it doesnt HAVE to compile to the JVM (it can compile to javascript if that's your thing) or native machine code.

it has some neat things like coroutines that generate the statemachine for you so if you have something like:

code:
val fibonacciSeq = buildSequence {
    var a = 0
    var b = 1
 
    yield(1)
 
    while (true) {
        yield(a + b)
 
        val tmp = a + b
        a = b
        b = tmp
    }
}

fun main() {
  fibonacciSeq.take(30).forEach { println(it) }
}
it actually builds the state information into the object and hides it from you, while giving you generator like reentrant coroutines.

also it does the non-blocking poo poo, so you get pretty easy concurrency and whatnot if that's your thing without having to deal with futures.

spring 5.2 is adding support for coroutines in controller methods so you can do poo poo like:

code:
@RestController
class Yospos {
    @GetMapping("/bithc")
    fun flowEndpoint() = flow {
        (1..10).forEach {
          emit("YOSPOS")
          delay(10)
        }
    }
}
and it is a non-blocking async endpoint that doesn't spawn a thread per request and is handled by netty

Spime Wrangler
Feb 23, 2003

Because we can.

DONT THREAD ON ME posted:

insofar as anything on the jbm is java i guess

jaba birtual machime

Soricidus
Oct 20, 2010
freedom-hating statist shill

Finster Dexter posted:

I thought kotlin basically was java

it’s java without semicolons or checked exceptions. some people like these changes, others don’t

I think the second one also probably means it’s never safe to call kotlin from java, idk

CRIP EATIN BREAD
Jun 24, 2002

Hey stop worrying bout my acting bitch, and worry about your WACK ass music. In the mean time... Eat a hot bowl of Dicks! Ice T



Soiled Meat
the kotlin compiled javascript code isnt bad either, it trims out poo poo you dont need and seems to work pretty damned well. i dont have any need for javascript in my work (inshallah), but i was curious to see what it did and it's pretty smart about mapping kotlin collections to basic javscript stuff and doesn't bring in a massive supporting runtime.

you cant use any of the java stuff (java.time, etc) but you do get the entire kotlin stdlib and they even map assertions and whatnot so you can run your tests in both the jvm and js without rewriting poo poo.

CRIP EATIN BREAD
Jun 24, 2002

Hey stop worrying bout my acting bitch, and worry about your WACK ass music. In the mean time... Eat a hot bowl of Dicks! Ice T



Soiled Meat

Soricidus posted:

it’s java without semicolons or checked exceptions. some people like these changes, others don’t

I think the second one also probably means it’s never safe to call kotlin from java, idk

its perfectly safe to call kotlin from java because it just means that you have to catch the exceptions. in the jvm the kotlin exceptions are just subclasses of RuntimeException, you don't have to worry about it.

all the kotlin properties get mapped internally to java style getter/setters (getX, setY), there's very little you can't do when calling kotlin from java.

Soricidus
Oct 20, 2010
freedom-hating statist shill

CRIP EATIN BREAD posted:

its perfectly safe to call kotlin from java because it just means that you have to catch the exceptions. in the jvm the kotlin exceptions are just subclasses of RuntimeException, you don't have to worry about it.

I’m thinking of the case where your java calls some kotlin code, that in turn calls some java code that throws a checked exception, that the kotlin code doesn’t catch. what happens then?

CRIP EATIN BREAD
Jun 24, 2002

Hey stop worrying bout my acting bitch, and worry about your WACK ass music. In the mean time... Eat a hot bowl of Dicks! Ice T



Soiled Meat
if you are worried about interop like that then you can be explicit for java:

code:
@Throws(SomeCheckedException::class)
fun yospos()
but that usecase seems sorta weird to me. you're usually only going in one direction

Soricidus
Oct 20, 2010
freedom-hating statist shill
what’s rare about this use case? it can happen trivially if anyone ever writes a library in kotlin.

- person a writes useful library a in java
- person b writes useful library b in kotlin, depends on library a
- I write a program in java, that depends on library b

like sure it’ll be fine if person b thought of java interop and knew that library a throws checked exceptions and added the right annotations as so on, but what happens if they didn’t?

(you might reasonably argue that this whole problem just proves that checked exceptions were a mistake, but that’s beside the point)

DONT THREAD ON ME
Oct 1, 2002

by Nyc_Tattoo
Floss Finder
scala has the same issue and in practice it's not really a problem. most scala libraries are either scala-y wrappers around java, or so functional/scala oriented that no sane java person would want to use them. in the few cases where there are libraries written in scala that need to be java friendly, you just have separate java/scala apis that call the lower level code.

Powerful Two-Hander
Mar 9, 2004

Mods please change my name to "Tooter Skeleton" TIA.



trip report: redleader was right (and shaggar )

using option recompile halved query time because a new plan is better than no plan (or a hosed up one from doing param redeclares) and the variable nature of the inputs means there's no practical loss of performance form losing plan caching. Whether it will fix the prod issues.... Eh who cares I learned something.

Thanks yospos, thospos.

Finster Dexter
Oct 20, 2014

Beyond is Finster's mad vision of Earth transformed.
kotlin sounds cool and good, especially the part about concurrency, as the baked-in concurrency is one of the few things I actually like about Go, and it sounds like kotlin has something similar.

animist
Aug 28, 2018
the worst data format i've had to work with recently is json-ld, which is the result of the semantic web people getting their greasy hands on json

code:
{
  "@graph": [
    {
      "http://schema.org/description": "The Empire State Building is a 102-story landmark in New York City.",
      "http://schema.org/geo": {
        "@id": "_:b1",
        "http://schema.org/latitude": "40.75",
        "http://schema.org/longitude": "73.98"
      },
      "http://schema.org/image": {
        "@id": "http://www.civil.usherbrooke.ca/cours/gci215a/empire-state-building.jpg"
      },
      "http://schema.org/name": "The Empire State Building"
    },
    {
      "@id": "_:b1",
      "http://schema.org/latitude": "40.75",
      "http://schema.org/longitude": "73.98"
    },
    {
      "@id": "http://www.civil.usherbrooke.ca/cours/gci215a/empire-state-building.jpg"
    }
  ],
  "@context": "https://w3id.org/security/v1",
  "signature": {
    "type": "EcdsaKoblitzSignature2016",
    "created": "2019-06-07T03:23:16Z",
    "creator": "ecdsa-koblitz-pubkey:020d79074ef137d4f338c2e6bef2a49c618109eccf1cd01ccc3286634789baef4b",
    "signatureValue": "IJY25idmG+Yvy9kB57yNB6WNRU9jLtb8Vv6BEEIus9mcQTIpyPr25H3tx876WA7c1DXl8Wcx7TPvOSovKQ3HbyE="
  }
}
yes, that is RDF embedded in JSON. it's also signed with the bitcoin elliptic curve because they're pushing this to the blockchain people for some godforsaken reason

the talent deficit
Dec 20, 2003

self-deprecation is a very british trait, and problems can arise when the british attempt to do so with a foreign culture





animist posted:

the worst data format i've had to work with recently is json-ld, which is the result of the semantic web people getting their greasy hands on json

...

yes, that is RDF embedded in JSON. it's also signed with the bitcoin elliptic curve because they're pushing this to the blockchain people for some godforsaken reason

rdf rules but encoding it in json is not great because it makes people think it should be human readable/writeable

DONT THREAD ON ME
Oct 1, 2002

by Nyc_Tattoo
Floss Finder

animist posted:

the worst data format i've had to work with recently is json-ld, which is the result of the semantic web people getting their greasy hands on json

code:
{
  "@graph": [
    {
      "http://schema.org/description": "The Empire State Building is a 102-story landmark in New York City.",
      "http://schema.org/geo": {
        "@id": "_:b1",
        "http://schema.org/latitude": "40.75",
        "http://schema.org/longitude": "73.98"
      },
      "http://schema.org/image": {
        "@id": "http://www.civil.usherbrooke.ca/cours/gci215a/empire-state-building.jpg"
      },
      "http://schema.org/name": "The Empire State Building"
    },
    {
      "@id": "_:b1",
      "http://schema.org/latitude": "40.75",
      "http://schema.org/longitude": "73.98"
    },
    {
      "@id": "http://www.civil.usherbrooke.ca/cours/gci215a/empire-state-building.jpg"
    }
  ],
  "@context": "https://w3id.org/security/v1",
  "signature": {
    "type": "EcdsaKoblitzSignature2016",
    "created": "2019-06-07T03:23:16Z",
    "creator": "ecdsa-koblitz-pubkey:020d79074ef137d4f338c2e6bef2a49c618109eccf1cd01ccc3286634789baef4b",
    "signatureValue": "IJY25idmG+Yvy9kB57yNB6WNRU9jLtb8Vv6BEEIus9mcQTIpyPr25H3tx876WA7c1DXl8Wcx7TPvOSovKQ3HbyE="
  }
}
yes, that is RDF embedded in JSON. it's also signed with the bitcoin elliptic curve because they're pushing this to the blockchain people for some godforsaken reason

no.

eschaton
Mar 7, 2007

the knowledge knower. a wisdom imparter. irritatingly self-assertive. odorous.

the talent deficit posted:

rdf rules but encoding it in json is not great because it makes people think it should be human readable/writeable

it should be S-expressions as McCarthy and Lenat intended drat it

Sagacity
May 2, 2003
Hopefully my epitaph will be funnier than my custom title.

eschaton posted:

McCartney and Lennon
ftfy

duz
Jul 11, 2005

Come on Ilhan, lets go bag us a shitpost


animist posted:

they're pushing this to the blockchain people for some godforsaken reason

so at least it will never be used by anyone who matters

kitten emergency
Jan 13, 2008

get meow this wack-ass crystal prison

animist posted:

the worst data format i've had to work with recently is json-ld, which is the result of the semantic web people getting their greasy hands on json

code:
{
  "@graph": [
    {
      "http://schema.org/description": "The Empire State Building is a 102-story landmark in New York City.",
      "http://schema.org/geo": {
        "@id": "_:b1",
        "http://schema.org/latitude": "40.75",
        "http://schema.org/longitude": "73.98"
      },
      "http://schema.org/image": {
        "@id": "http://www.civil.usherbrooke.ca/cours/gci215a/empire-state-building.jpg"
      },
      "http://schema.org/name": "The Empire State Building"
    },
    {
      "@id": "_:b1",
      "http://schema.org/latitude": "40.75",
      "http://schema.org/longitude": "73.98"
    },
    {
      "@id": "http://www.civil.usherbrooke.ca/cours/gci215a/empire-state-building.jpg"
    }
  ],
  "@context": "https://w3id.org/security/v1",
  "signature": {
    "type": "EcdsaKoblitzSignature2016",
    "created": "2019-06-07T03:23:16Z",
    "creator": "ecdsa-koblitz-pubkey:020d79074ef137d4f338c2e6bef2a49c618109eccf1cd01ccc3286634789baef4b",
    "signatureValue": "IJY25idmG+Yvy9kB57yNB6WNRU9jLtb8Vv6BEEIus9mcQTIpyPr25H3tx876WA7c1DXl8Wcx7TPvOSovKQ3HbyE="
  }
}
yes, that is RDF embedded in JSON. it's also signed with the bitcoin elliptic curve because they're pushing this to the blockchain people for some godforsaken reason

gently caress this

Feisty-Cadaver
Jun 1, 2000
The worms crawl in,
The worms crawl out.
I’m http://schema.org/longitude iykwim

CRIP EATIN BREAD
Jun 24, 2002

Hey stop worrying bout my acting bitch, and worry about your WACK ass music. In the mean time... Eat a hot bowl of Dicks! Ice T



Soiled Meat
i like how a json "schema" doesnt even indicate whether it should be decimal or degrees, minutes and seconds.

but of course it's that way because nobody who uses json has half a brain or deserves to be taken seriously because web dev is for idiots

pseudorandom
Jun 16, 2010



Yam Slacker

animist posted:

the worst data format i've had to work with recently is json-ld, which is the result of the semantic web people getting their greasy hands on json

code:
{
  "@graph": [
    {
      "http://schema.org/description": "The Empire State Building is a 102-story landmark in New York City.",
      "http://schema.org/geo": {
        "@id": "_:b1",
        "http://schema.org/latitude": "40.75",
        "http://schema.org/longitude": "73.98"
      },
      "http://schema.org/image": {
        "@id": "http://www.civil.usherbrooke.ca/cours/gci215a/empire-state-building.jpg"
      },
      "http://schema.org/name": "The Empire State Building"
    },
    {
      "@id": "_:b1",
      "http://schema.org/latitude": "40.75",
      "http://schema.org/longitude": "73.98"
    },
    {
      "@id": "http://www.civil.usherbrooke.ca/cours/gci215a/empire-state-building.jpg"
    }
  ],
  "@context": "https://w3id.org/security/v1",
  "signature": {
    "type": "EcdsaKoblitzSignature2016",
    "created": "2019-06-07T03:23:16Z",
    "creator": "ecdsa-koblitz-pubkey:020d79074ef137d4f338c2e6bef2a49c618109eccf1cd01ccc3286634789baef4b",
    "signatureValue": "IJY25idmG+Yvy9kB57yNB6WNRU9jLtb8Vv6BEEIus9mcQTIpyPr25H3tx876WA7c1DXl8Wcx7TPvOSovKQ3HbyE="
  }
}
yes, that is RDF embedded in JSON. it's also signed with the bitcoin elliptic curve because they're pushing this to the blockchain people for some godforsaken reason


I like how they aren't HTTPS urls.



I'm "http://schema.org/description"


quote:

EXAMPLE OF A DESCRIPTION
code:
 <script type="text/javascript">
var fo = new FlashObject("http://google.com/flash/preview-player.swf",... 
</script>

:psyduck: Yes, the Flash player definitely helps me understand what a "description" is.

I like how every time I try to "Preview Reply" for this message CloudFlare makes me prove I'm not a robot beep boop

oh boy, I sure do love identifying store fronts

Osmosisch
Sep 9, 2007

I shall make everyone look like me! Then when they trick each other, they will say "oh that Coyote, he is the smartest one, he can even trick the great Coyote."



Grimey Drawer

pseudorandom posted:

I like how they aren't HTTPS urls.

There's plenty to complain about, but this doesn't really matter, they're all just identifiers, not actual resources.

We're using json+ld in some bits of our application and it's been OK, except that there's some aggravating corner cases/bugs in the jena de/serializer.

eschaton
Mar 7, 2007

the knowledge knower. a wisdom imparter. irritatingly self-assertive. odorous.
it’s sad Cycorp shut down their OpenCyc ontology server, it put this scheme.org poo poo to shame

maybe I need to set up OpenCyc 4.0 on a server somewhere just to let people reference its grown up ontology

Falcorum
Oct 21, 2010
I like how people complain about C++ tooling and at first you're like "maybe they have a point, it is kinda poo poo" and then you hear them talk about maven, gradle, whatever and you're just like "nah, I'm good"

gonadic io
Feb 16, 2011

>>=

Falcorum posted:

I like how people complain about C++ tooling and at first you're like "maybe they have a point, it is kinda poo poo" and then you hear them talk about maven, gradle, whatever and you're just like "nah, I'm good"

this is stockhom syndrome talking, until you've tried it you have no idea what the other ones are actually like - anecdotes or complaints aren't indicative.

gradle and sbt are poo poo though but luckily there are good ones out there!

Fiedler
Jun 29, 2002

I, for one, welcome our new mouse overlords.
the biggest problem with c++ tooling is c++

redleader
Aug 18, 2005

Engage according to operational parameters
i hear maven is good yo

Soricidus
Oct 20, 2010
freedom-hating statist shill
it really is, unless you’re actually allergic to xml, or have extremely specific and unusual requirements

Blinkz0rz
May 27, 2001

MY CONTEMPT FOR MY OWN EMPLOYEES IS ONLY MATCHED BY MY LOVE FOR TOM BRADY'S SWEATY MAGA BALLS
imo gradle is fine if you're not doing anything crazy

where crazy is anything beyond dependency management

Plorkyeran
Mar 21, 2007

To Escape The Shackles Of The Old Forums, We Must Reject The Tribal Negativity He Endorsed
gradle is fine if you don't mind a build too that takes a minute just to decide what to build every time

Soricidus
Oct 20, 2010
freedom-hating statist shill

Blinkz0rz posted:

imo gradle is fine if you're not doing anything crazy

where crazy is anything beyond dependency management

using a limited subset of gradle is fine in the same sense that having a beer and then getting in the drivers seat is fine. technically it might be legal and statistically speaking you’ll probably get home safely but it’s still really loving stupid and wrong (and most of the people who claim to do it regularly it are lying about where they draw the line)

Shaggar
Apr 26, 2006
at best gradle can maybe be almost as good as maven in extremely basic scenarios. idk why you would ever choose to use gradle

Blinkz0rz
May 27, 2001

MY CONTEMPT FOR MY OWN EMPLOYEES IS ONLY MATCHED BY MY LOVE FOR TOM BRADY'S SWEATY MAGA BALLS

Soricidus posted:

using a limited subset of gradle is fine in the same sense that having a beer and then getting in the drivers seat is fine. technically it might be legal and statistically speaking you’ll probably get home safely but it’s still really loving stupid and wrong (and most of the people who claim to do it regularly it are lying about where they draw the line)

:hmmyes:

Sagebrush
Feb 26, 2012


professor lumpy balls, they call me
gradle? more like grundle

Sagacity
May 2, 2003
Hopefully my epitaph will be funnier than my custom title.
gradle always feels like it's on the edge of becoming usable but somehow never is

for instance, they never supported importing maven boms until recently but then immediately introduced 4 subtly different ways of specifying a version override

they now also use kotlin scripts which is cool and gives you autocomplete but kinda is not completely supported by all tooling

meanwhile maven just uses xml which already has autocomplete and ide support for years

leftist heap
Feb 28, 2013

Fun Shoe
maven is very good

Adbot
ADBOT LOVES YOU

brand engager
Mar 23, 2011

The kotlin gradle stuff still does everything through the same gradle api, so choosing kotlin or groovy is mostly just an aesthetic choice.

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