News for hackers. Stuff that matters.
Re:Codem Ipsum: Lorem Ipsum but for Code by BerislavLopac on Friday November 15, 2019 @08:29AM (#21544569)
Why code in faux Latin when you can use the real thing: http://users.monash.edu/~damian/papers/HTML/Perligata.html
Re:Codem Ipsum: Lorem Ipsum but for Code by airstrike on Friday November 15, 2019 @10:53AM (#21545793)
This is clearly the work of both a madman and a genius
Re:Codem Ipsum: Lorem Ipsum but for Code by ClumsyPilot on Friday November 15, 2019 @10:19AM (#21545496)
This is so cool! I love it.

I am a Russian speaker, and this ambiguous aspect of English has always bugged me to hell! I think english was a bad model as a starting point for programming languages.

Re:Codem Ipsum: Lorem Ipsum but for Code by Aloha on Friday November 15, 2019 @11:12AM (#21545998)
How so?
Re:Codem Ipsum: Lorem Ipsum but for Code by SamBam on Friday November 15, 2019 @11:29AM (#21546180)
I'm guessing they're referring to linguistic features that English doesn't have, such as inflected nouns to unambiguously indicate the subject, direct object and indirect objects.

`bite(dog, man)` is ambiguous. You need to look up the function documentation, make a guess, or ask the library developer to come up with a less ambiguous name.

If you could decline your variables, however, you could write (in terrible fake Latin)

`bite(dog, man-um)` or `bite(dog-um, man)` and they would be interpreted as two different -- and unambiguous -- things.

...but I'm just repeating GP's article.

Re:Codem Ipsum: Lorem Ipsum but for Code by zamubafoo on Friday November 15, 2019 @11:53AM (#21546402)
It might just be me, but isn't that just how you name your attributes within the function definition? I don't see how that would help disambiguate without have to look at the function definition at the very least.
Re:Codem Ipsum: Lorem Ipsum but for Code by SamBam on Friday November 15, 2019 @02:11PM (#21547763)
The point is it's a new way of looking at arguments (in this toy example). In Latin, the order of the nouns typically does not matter. Their role in the statement is unambiguously determined by their declension.

So if you wrote a library with the verb "bite", you wouldn't specify that the first bites the second, or the first was bitten by the second. Those are ambiguous, because they're you're choice as a developer. Rather, you'd specify that the noun in the subject case bites the noun in the object case. That's unambigious in all declined languages.

So, as a reader of someone else's code, I can see immediately that `bite(boy-um, dog)` -- in my fake Latin where "um" denotes the object (cf. "Puer - Puerum") -- that the boy was bitten by the dog. I don't need to look up any documentation or look at how the variables are named in a third-party library.

Again, of course this case is a toy example. The article is more in-depth.

Re:Codem Ipsum: Lorem Ipsum but for Code by tuesdayrain on Friday November 15, 2019 @05:28PM (#21549418)
`bite({from:Dog,to:Man})` solves the ambiguity in my opinion.
Re:Codem Ipsum: Lorem Ipsum but for Code by meddlepal on Friday November 15, 2019 @11:36AM (#21546249)
I just proposed my team switch to this haha, awesome.
Re:Codem Ipsum: Lorem Ipsum but for Code by jacobush on Friday November 15, 2019 @09:12AM (#21544895)
I didn't expect it, but I thought Perligata is more readable than Perl.
Re:Codem Ipsum: Lorem Ipsum but for Code by skykooler on Friday November 15, 2019 @10:10AM (#21545392)
At least, apart from numbers, which all are rendered in Roman numerals.
Re:Codem Ipsum: Lorem Ipsum but for Code by libeclipse on Friday November 15, 2019 @09:22AM (#21544986)
Not a difficult task lol
Re:Codem Ipsum: Lorem Ipsum but for Code by abhijitparida on Friday November 15, 2019 @08:17AM (#21544488)
The name is kind of misleading. I expected it to generate random lines of code, instead of just replacing identifiers with lorem ipsum.
Re:Codem Ipsum: Lorem Ipsum but for Code by moontear on Friday November 15, 2019 @10:14AM (#21545445)
Same thought here. I thought something along the lines of hackertyper. Something that looks like real code, but isn't.
Re:Codem Ipsum: Lorem Ipsum but for Code by Sohcahtoa82 on Friday November 15, 2019 @08:02PM (#21550223)
> I thought something along the lines of hackertyper. Something that looks like real code, but isn't.

Hackertyper is absolutely using real code.

Specifically, it's using groups.c from the Linux kernel:

https://github.com/torvalds/linux/blob/master/kernel/groups....

Compare that to the code used by Hackertyper:

http://hackertyper.com/code.txt

Re:Codem Ipsum: Lorem Ipsum but for Code by XCabbage on Friday November 15, 2019 @08:27AM (#21544555)
For whatever it's worth, I didn't share your expectation. The real lorem ipsum is just a fixed load of text, after all - describing something as "lorem ipsum but for code" shouldn't necessarily imply any functionality.
Re:Codem Ipsum: Lorem Ipsum but for Code by wongarsu on Friday November 15, 2019 @09:27AM (#21545035)
Given that lorem ipsum is a fixed load of text, as you said, I would have expected a lorem ipsum for code to be a fixed load of code (that's nonsensical but looks real enough from afar).
Re:Codem Ipsum: Lorem Ipsum but for Code by FunnyLookinHat on Friday November 15, 2019 @08:49AM (#21544711)
I thought the same thing.
Re:Codem Ipsum: Lorem Ipsum but for Code by pomber on Friday November 15, 2019 @08:14AM (#21544462)
Hey, I made this. I needed dummy but syntactically valid code to show in demos like this one: https://github.com/pomber/code-surfer/blob/code-surfer-v2/re...
Re:Codem Ipsum: Lorem Ipsum but for Code by omarhaneef on Friday November 15, 2019 @10:04AM (#21545342)
Wait, this is just for dummy code for demos? I've been using at work for our production system. I figured the compiler would catch any mistakes...
Re:Codem Ipsum: Lorem Ipsum but for Code by john-radio on Friday November 15, 2019 @10:31AM (#21545611)
Let me know how it goes with the compiler, I've got too much angel capital invested in this by now for it not to work!
Re:Codem Ipsum: Lorem Ipsum but for Code by swagonomixxx on Friday November 15, 2019 @11:38AM (#21546266)
As some others in this thread, I feel bamboozled.

What I was hoping for is a "Lorem Ipsum"-style generator for code for like 10 different languages. So you'd have a Lorem Ipsum for JS, C++, Rust, etc.

This is just find/replacing identifiers with lorem ipsum, which doesn't really mask the underlying code that well.

Re:Codem Ipsum: Lorem Ipsum but for Code by 0xDEEPFAC on Friday November 15, 2019 @08:10AM (#21544439)
Lorem Ipsum but for javascript
Re:Codem Ipsum: Lorem Ipsum but for Code by Someone on Friday November 15, 2019 @08:41AM (#21544638)
Unfortunately, this doesn’t lorem ipsum code comments.

I also wonder how large such an obfuscated code fragment would need to be to be able to find back the original code on GitHub/GitLab.

Re:Codem Ipsum: Lorem Ipsum but for Code by mike_hock on Friday November 15, 2019 @08:00AM (#21544400)
The "lorem ipsum" identifier names are foo, bar, baz, qux, quux, etc.
Re:Codem Ipsum: Lorem Ipsum but for Code by wa1987 on Friday November 15, 2019 @08:07AM (#21544427)
Re:Codem Ipsum: Lorem Ipsum but for Code by lettergram on Friday November 15, 2019 @07:58AM (#21544391)
No description of what’s happening (on mobile anyway), but it looks like the variables are being replaced?
Re:Codem Ipsum: Lorem Ipsum but for Code by tyingq on Friday November 15, 2019 @08:04AM (#21544414)
Identifiers too. It's using the babel.js compiler so the approach is pretty straightforward: https://github.com/pomber/codem-ipsum/blob/master/index.html
Re:Codem Ipsum: Lorem Ipsum but for Code by madacol on Friday November 15, 2019 @10:43AM (#21545724)
I think it should not replace the `length` property of an intentional array.
Re:Codem Ipsum: Lorem Ipsum but for Code by gatherhunterer on Friday November 15, 2019 @09:11AM (#21544889)
It looks like dolor is assigned without first being initialized.
Re:Codem Ipsum: Lorem Ipsum but for Code by pc86 on Friday November 15, 2019 @09:21AM (#21544978)
No, it's passed in as a parameter with a default value of 1
Re:Codem Ipsum: Lorem Ipsum but for Code by gatherhunterer on Friday November 15, 2019 @09:25AM (#21545012)
I see, the two columns are hard to read on mobile.
Re:Codem Ipsum: Lorem Ipsum but for Code by Raphmedia on Friday November 15, 2019 @11:44AM (#21546323)
It keeps throwing me

"SyntaxError: unknown: Unexpected token (1:20)"

on valid code

Re:Codem Ipsum: Lorem Ipsum but for Code by cryptozeus on Friday November 15, 2019 @01:54PM (#21547596)
Where would one use this ?