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.
 
  • Locked thread
DONT THREAD ON ME
Oct 1, 2002

by Nyc_Tattoo
Floss Finder
i picked up beautiful code and forgot why and thought i must have boought it in a rare lapse of bsd programming judgement but now im excited to read it

Adbot
ADBOT LOVES YOU

tef
May 30, 2004

-> some l-system crap ->
(in that series, i enjoyed 'masterminds of programming' more.


programmers are bad at docs and uh it shows in 'beautiful code'

my fav chapter is the kernighan and pike chapter

and it's an excerpt from practice of programming)

MononcQc
May 29, 2007

I like documentation a whole lot and I feel it is systemically undervalued as part of development. You know culture around it is bad when some people have been broken to the point they don't trust any docs at all because of so bad/outdated some of it has become.

I try to apologize every time someone has to go dig into the source.

tef
May 30, 2004

-> some l-system crap ->
or digging through the tests b/c they're easier to read than the source w

Bloody
Mar 3, 2013

I want to write my own linter slash static analyzer slash maybe custom macro expander tool (it's kind of open ended) is antlr the right place to start

Jerry Bindle
May 16, 2003

Bloody posted:

I want to write my own linter slash static analyzer slash maybe custom macro expander tool (it's kind of open ended) is antlr the right place to start

yeah i think so. antlr is really good, but be prepared to spend $30 or type filetype:pdf into google, as you'll need the book to get anything at all done with it.

Bloody
Mar 3, 2013

alternately: is this a reasonable thing to do in haskell and if so is it possible to reuse these antlr grammars i found i dont want to write my own grammar

Blinkz0rz
May 27, 2001

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

tef posted:

christ

???

tef
May 30, 2004

-> some l-system crap ->

it is weirding me out that people found it that useful because i swear i've written the same thing over and over again

Blinkz0rz
May 27, 2001

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

tef posted:

it is weirding me out that people found it that useful because i swear i've written the same thing over and over again

we have a 10xer who buries everything under a million layers of abstraction which makes maintaining his stuff a herculean effort

it's nice to get some buy in from other team members to actively reduce the complexity of our code

VikingofRock
Aug 24, 2008




Bloody posted:

alternately: is this a reasonable thing to do in haskell and if so is it possible to reuse these antlr grammars i found i dont want to write my own grammar

This is definitely a reasonable thing to do in Haskell, and is IMO one of the places where the language really shines. You can either use alex + happy to automatically generate a lexer + parser (similar to using lex and yacc in C), or you can roll your own fairly easily. I've personally never used alex and happy, but there are tutorials on the above-linked sites and there are lots of examples of their use out there. For example here is a chapter on using alex + happy to write a compiler for a toy functional language, and here is an example of someone writing a Python 3 interpreter using them. If you want to roll your own parser, I would recommend using either MegaParsec or Earley. The former is an actively-maintained fork of a pretty well-known parsing library called Parsec, and the latter neatly handles things like left-recursive grammars while allowing you to write directly in Haskell (instead of needing a separate tool like alex and happy). You also might want to look at trifecta, which is known for allowing you to write very cool and pretty error messages.

VikingofRock fucked around with this message at 05:54 on Mar 21, 2016

fart simpson
Jul 2, 2005

DEATH TO AMERICA
:xickos:

parsec is pretty cool + good

hackbunny
Jul 22, 2007

I haven't been on SA for years but the person who gave me my previous av as a joke felt guilty for doing so and decided to get me a non-shitty av

MononcQc posted:

I like documentation a whole lot and I feel it is systemically undervalued as part of development. You know culture around it is bad when some people have been broken to the point they don't trust any docs at all because of so bad/outdated some of it has become.

I try to apologize every time someone has to go dig into the source.

documentation is never specific enough for me. Qt documentation on QObjects and the signal/slot system for example is pretty wishy-washy, especially regarding cross-thread signals and the inevitable setup/teardown mess. reading the sources spared me a lot of experimentation, which I'm never super comfortable about because I tend to work on environments that lack a REPL or even a simulator that works

Bloody
Mar 3, 2013

VikingofRock posted:

This is definitely a reasonable thing to do in Haskell, and is IMO one of the places where the language really shines. You can either use alex + happy to automatically generate a lexer + parser (similar to using lex and yacc in C), or you can roll your own fairly easily. I've personally never used alex and happy, but there are tutorials on the above-linked sites and there are lots of examples of their use out there. For example here is a chapter on using alex + happy to write a compiler for a toy functional language, and here is an example of someone writing a Python 3 interpreter using them. If you want to roll your own parser, I would recommend using either MegaParsec or Earley. The former is an actively-maintained fork of a pretty well-known parsing library called Parsec, and the latter neatly handles things like left-recursive grammars while allowing you to write directly in Haskell (instead of needing a separate tool like alex and happy). You also might want to look at trifecta, which is known for allowing you to write very cool and pretty error messages.

awesome, tyvm

~Coxy
Dec 9, 2003

R.I.P. Inter-OS Sass - b.2000AD d.2003AD

Wheany posted:

has there been any studies if people like "whoops, something went wrong, lol" -type errors more than "database error, error code 0xdeadbeef, please contact your system administrator" -type errors?

because the former aggravate the gently caress out of me. but then i'm a programmer, maybe actual people like that

I read one once that said if you provide a error code or specific message that users won't read it or c/p it anyway

not sure how scientific it was

gonadic io
Feb 16, 2011

>>=

~Coxy posted:

I read one once that said if you provide a error code or specific message that users won't read it or c/p it anyway

not sure how scientific it was

In my experience of teaching: it takes some coaching to get new students to actually read compiler/interpreter error messages

Wheany
Mar 17, 2006

Spinyahahahahahahahahahahahaha!

Doctor Rope
i meant more the tone of "aww, snap" type 'cute' errors compared to dry "notepad.exe has encountered an error and needs to close" type errors.

MononcQc
May 29, 2007

hackbunny posted:

documentation is never specific enough for me. Qt documentation on QObjects and the signal/slot system for example is pretty wishy-washy, especially regarding cross-thread signals and the inevitable setup/teardown mess. reading the sources spared me a lot of experimentation, which I'm never super comfortable about because I tend to work on environments that lack a REPL or even a simulator that works

Yeah. I guess this is one of the most challenging things. And even people's behaviour doesn't help. In general, the attitude is that people want short concise documentation that tells them how to get going, but they also want a comprehensive documentation that gives all the details.

The result is that if you write short concise docs, you have to possibly omit elements and people dislike it, and if you write comprehensive docs, people find it too long and will skip around to code samples and only focus on that.

I'm not sure what to do there ever.

Bloody
Mar 3, 2013

is it hosed up if my build process includes building tools that run the back half of the build process like some sort of hosed up nesting doll build process

Deep Dish Fuckfest
Sep 6, 2006

Advanced
Computer Touching


Toilet Rascal
not really. i mean, if the tools change often enough that it's worthwhile to potentially rebuild them all the time, then it makes sense to me

then again i hate every build system and nothing infuriates me more than trying to build a project for the first time. as far as i'm concerned adding some bullshit to a build process is just adding more to the existing pile of bullshit

Brain Candy
May 18, 2006

MononcQc posted:

Yeah. I guess this is one of the most challenging things. And even people's behaviour doesn't help. In general, the attitude is that people want short concise documentation that tells them how to get going, but they also want a comprehensive documentation that gives all the details.

The result is that if you write short concise docs, you have to possibly omit elements and people dislike it, and if you write comprehensive docs, people find it too long and will skip around to code samples and only focus on that.

I'm not sure what to do there ever.

a helpful thing i'm sure you already do is to write a good declarative first sentence/paragraph, with the details below it

you can see it in git commit guides, javadoc guides, etc. those who just care about what a thing are satisfied by your punchline, people who want to read more read more. links are great for this too

but i think that part of the problem is trying to do two things at once; a tutorial is not the same thing as documentation. documentation as i'm meaning it is part of the specification of the code. it's a reference that you read as needed, where a tutorial is generally intended to be followed linearly.

of course the line is blurry when you put code in the proper documentation, but even then those tend to be simple examples rather than something that forms a narrative

Jabor
Jul 16, 2010

#1 Loser at SpaceChem

Bloody posted:

is it hosed up if my build process includes building tools that run the back half of the build process like some sort of hosed up nesting doll build process

not at all. your final output depends on the tools used to create it, there's nothing wrong with encoding that dependency in the build process instead of leaving it as an ad-hoc "oh yeah and it only compiles with this special snowflake compiler version" bit of oral tradition

if you do do that, though, you're really going to want to have good caching so that you're not actually burning time and cpu cycles recompiling the tools for the 99% of builds where they haven't actually changed

Bloody
Mar 3, 2013

cool. in this case the tool is just a wrapper to automate the fpga build process so its build time is very trivial compared to the fpga build process time

it would be nice to do something about the hard dep on "this specific hosed up version of the fpga build chain" but lol at that ever happening

Shaggar
Apr 26, 2006
in a good build system the tools are defined in the pom and discovered and pulled in at build time.

everything else is variations on terrible scripting.

Bloody
Mar 3, 2013

i'll make sure to let the most user/customer-hostile vendors in the world know that their build systems are bad and should be replaced by maven, i am sure they will be responsive

Shaggar
Apr 26, 2006
user-hostile is the industry standard for build systems.

Blinkz0rz
May 27, 2001

MY CONTEMPT FOR MY OWN EMPLOYEES IS ONLY MATCHED BY MY LOVE FOR TOM BRADY'S SWEATY MAGA BALLS
i loving hate how ruby allows optional parens

gently caress you ruby, i want to know at first glance if you're a goddamn method rather than searching the entire codebase

Bloody
Mar 3, 2013

im fuckin around with megaparsec and these tutorials are lackluster

Shaggar
Apr 26, 2006

Blinkz0rz posted:

i loving hate how ruby allows optional parens

gently caress you ruby, i want to know at first glance if you're a goddamn method rather than searching the entire codebase

lol ruby.

Bloody
Mar 3, 2013

although theres a good chance my difficulties stem from having at best a loose grasp of this whack rear end lang

piratepilates
Mar 28, 2004

So I will learn to live with it. Because I can live with it. I can live with it.



Doesn't Scala take that to a dumber step forward where you can omit the dot and parantheses all you want, so your method calls can turn in to a list of words with no punctuation

Bloody
Mar 3, 2013

everything in scala can be implicitly used infix iirc

Blinkz0rz
May 27, 2001

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

Shaggar posted:

lol ruby.

yeah the huge downside to chef

Shaggar
Apr 26, 2006

piratepilates posted:

Doesn't Scala take that to a dumber step forward where you can omit the dot and parantheses all you want, so your method calls can turn in to a list of words with no punctuation

scala is bad too

gonadic io
Feb 16, 2011

>>=

piratepilates posted:

Doesn't Scala take that to a dumber step forward where you can omit the dot and parantheses all you want, so your method calls can turn in to a list of words with no punctuation

Only for methods with one arg.
So "butts.filter(isGross)" is the same as "butts filter isGross".

On the other hand it's kinda useless because it's far more common to have a method inside too like "butts.filter(_.isGross)". But then the underscore syntax needs brackets anyway so the infix syntax is "butts filter (_.isGross)" which is a loving joke

Ps the same applies to all lambdas which the underscore syntax is sugar for

JimboMaloi
Oct 10, 2007

Bloody posted:

cool. in this case the tool is just a wrapper to automate the fpga build process so its build time is very trivial compared to the fpga build process time

it would be nice to do something about the hard dep on "this specific hosed up version of the fpga build chain" but lol at that ever happening

how frequently does the wrapper change? this seems like it should be solvable by pulling a known good binary at build-time if its not already present on the box, but i dont know what your build system looks like so maybe thats not an option. or i guess if it takes longer to download the binary than to compile.

Bloody
Mar 3, 2013

reasonably frequently, at least for now. it's mostly an academic question i guess; basically everything i do is only ever seen or used by me :v:

in haskell news, i think i know what a monoid is now. not sure what they have to do with endofunctors yet tho

VikingofRock
Aug 24, 2008




Bloody posted:

im fuckin around with megaparsec and these tutorials are lackluster
MegaParsec is similar enough to Parsec that you can pretty much just learn from tutorials for the latter. I think I learned it from the chapter on Parsec in Real World Haskell.

qntm
Jun 17, 2009

piratepilates posted:

Doesn't Scala take that to a dumber step forward where you can omit the dot and parantheses all you want, so your method calls can turn in to a list of words with no punctuation

Groovy does that I think

Adbot
ADBOT LOVES YOU

fart simpson
Jul 2, 2005

DEATH TO AMERICA
:xickos:

Bloody posted:

reasonably frequently, at least for now. it's mostly an academic question i guess; basically everything i do is only ever seen or used by me :v:

in haskell news, i think i know what a monoid is now. not sure what they have to do with endofunctors yet tho

functors in haskell are endofunctors. do you know what functor is yet?

  • Locked thread