Perl 6 - the future is here, just unevenly distributed

IRC log for #rosettacode, 2016-04-22

| Channels | #rosettacode index | Today | | Search | Google Search | Plain-Text | summary

All times shown according to UTC.

Time Nick Message
02:27 Coderjoe joined #rosettacode
03:28 mingc joined #rosettacode
03:54 kuzetsa joined #rosettacode
03:55 kuzetsa I'm looking at something on the rosettacode wiki where something is coded in a way I've never seen before
03:55 kuzetsa and I can't figure out if it's an escape or what O_O
03:55 kuzetsa https://rosettacode.org/wiki/JSON#Lua ~~~~~ it does this:
03:55 kuzetsa local json_data = [=[[
03:55 fedaykin "JSON - Rosetta Code"
03:55 kuzetsa I've never seen [=[[ before in lua
03:56 kuzetsa and I can't figure out what they're even doing with that particular witchcraft O_O
03:56 kuzetsa http://www.lua.org/pil/2.4.html ~~~ it's not representing a string / it's not a fancy way of quoting something
03:56 fedaykin "Programming in Lua : 2.4"
04:00 kuzetsa wait, it is?
04:00 kuzetsa [[ means it's a string literal?
04:00 kuzetsa so that was probably so they could include linebreaks and quote marks and whatnot?
05:15 kuzetsa heh, all this because someone spun their own method for saving / loading lua tables, and it had a bug I couldn't fix :)
05:16 kuzetsa the least painful fix was to refactor / replace the code to use json instead
05:29 Sanchitdua joined #rosettacode
05:30 Sanchitdua left #rosettacode
05:37 kuzetsa wow ok, so the example on rosetta code for using JSON from lua is linux / mac / posix-specific
05:37 kuzetsa not cross-platform at all
05:39 kuzetsa I say this because it relies on the luajson library, which in-turn relies on a library called "lpeg" which itself has to be compiled (using gcc / automake or whatever) ... but the makefile for that library appears to have been thrown together in a way which isn't portable
05:40 kuzetsa Not sure if it'll work with mingw gcc target (maybe?) but ... I'm not even sure how that'd work because it's like... hardcoded:
05:40 kuzetsa # For Linux
05:40 kuzetsa linux:
05:40 kuzetsa make lpeg.so "DLLFLAGS = -shared -fPIC"
05:40 kuzetsa # For Mac OS
05:40 kuzetsa macosx:
05:41 kuzetsa make lpeg.so "DLLFLAGS = -bundle -undefined dynamic_lookup"
06:10 mingc joined #rosettacode
06:24 kuzetsa I might have time at some point to refactor it (if any major changes are needed, like with the require() thinger) for lunajson, since that's cross-platform...
06:25 kuzetsa ... and since lunajson is pure json with no binary compile libraries, it completely bypasses any nuance for various schools of thought for cross-platform package management practices
06:26 kuzetsa there's a few JSON libraries out there for lua which are compiled, or require a compiled dependancy (on LPeg, even)
06:27 kuzetsa in my research, lunajson just seems to be the most popular pure-json one with reasonable levels of performance (perhaps even the best performance, and most mature of any which don't require compiled binary libraries to do the heavy lifting)
06:28 kuzetsa lua-cjson at least has support for the mingw gcc target, but not only that it's significantly faster than the luajson library used in the rosettacode example :)
06:29 kuzetsa either way is fine
09:06 kuzetsa oh well, the code example was still valid
09:07 kuzetsa "use a library"
09:08 kuzetsa the code using lunjason usage is otherwise identical to using the luajson library as per current example on https://rosettacode.org/wiki/JSON#Lua
09:08 fedaykin "JSON - Rosetta Code"
09:08 kuzetsa left #rosettacode
09:14 mingc joined #rosettacode

| Channels | #rosettacode index | Today | | Search | Google Search | Plain-Text | summary