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
JawnV6
Jul 4, 2004

So hot ...
I remember thinking of Python as this promised land when I was dealing with Perl 5 scripts around ASIC collaterals. They're never the product that you're actually shipping, just some shim garbage to make one tool's output fit into another tool's schema. I forwarded a script we used to make sense of this giant tree of muxes and the engineer sent back this giant screed blasting our entire team about how they'd never ship something that emitted so many warnings on success and welp ¯\_(ツ)_/¯ I wouldn't write it that way either, but I'm not itching to re-solve this problem for the sake of my terminal. It didn't even print a bell character.

Now I'm writing a BLE test suite. In bash :getin:

Adbot
ADBOT LOVES YOU

VikingofRock
Aug 24, 2008




TCL is also used in X-ray astronomy! :eng101:

TheresaJayne
Jul 1, 2011

VikingofRock posted:

TCL is also used in X-ray astronomy! :eng101:

my job in 1995 they had just released the trading floor software for the Irish Stock Exchange - Written in TCL/TK with DBase Backend

xzzy
Mar 5, 2009

Around here, most projects using tcl/tk for their gui have been replaced with Qt implementations, but all systems still need the packages installed because it occasionally shows up in a dependency of the software they're developing (ironically, a dozen or so .tcl files show up in Qt's source distribution).

Back in the day though? Man, tk was THE thing to be using.

"You mean I can make a gui with something that looks sort of like a shell script? And I can call actual shell scripts inside it? Well of course I want to use that! In fact we'll build an entire infrastructure around it, it'll be the perfect frontend for the tens of millions of dollars worth of scientific equipment we manage!"

Simulated
Sep 28, 2001
Lowtax giveth, and Lowtax taketh away.
College Slice

ExcessBLarg! posted:

Die? Not really sure how that works. None of the "plangs" are actually dead, Perl 5, Python, Ruby, and PHP are all very much around. As much as I would probably like to see PHP go away, it's so widely used it probably never will. Tcl might be dead.

Programming languages never die, they just run in/on javascript.

Volguus
Mar 3, 2009

Ender.uNF posted:

Programming languages never die, they just run in/on javascript.

And it's not even the only one:

quote:

There are several other implementations of Tcl in Javascript ...

Beef
Jul 26, 2004
I have a colleague down the hall that daily works with FORTRAN, it's still has a good niche in HPC-land.
An ex-colleague moved to work on a startup doing COBOL code analysis.
And I still love to work in Lisp languages.

Yep, languages that had seen some use will keep sticking around long after we're not.

Pollyanna
Mar 5, 2005

Milk's on them.


Clojure exists. Lisp is far from dead.

Hollow Talk
Feb 2, 2014

Beef posted:

I have a colleague down the hall that daily works with FORTRAN, it's still has a good niche in HPC-land.
An ex-colleague moved to work on a startup doing COBOL code analysis.
And I still love to work in Lisp languages.

Yep, languages that had seen some use will keep sticking around long after we're not.

The German Meteorological Service 's main weather models are written in FORTRAN with a nice sprinkling of ksh, running on a CRAY XC40. :sun:

Pollyanna posted:

Clojure exists. Lisp is far from dead.

Racket seems to be a semi-popular learning language as well.

carry on then
Jul 10, 2010

by VideoGames

(and can't post for 10 years!)

There are people in other departments at work that work primarily in PL/X :getin:

CPColin
Sep 9, 2003

Big ol' smile.
code:
//added this
Thanks. Great comment.

Dessert Rose
May 17, 2004

awoken in control of a lucid deep dream...

Hollow Talk posted:


Racket seems to be a semi-popular learning language as well.

It's not a bad scripting language either.

Gul Banana
Nov 28, 2003

carry on then posted:

There are people in other departments at work that work primarily in PL/X :getin:

I used to be one of them! It's honestly a pretty good alternative to C

Hollow Talk
Feb 2, 2014

Dessert Rose posted:

It's not a bad scripting language either.

I technically agree. However, the problem with command-line arguments (which is probably more in line with this thread) is that all parameters are always strings. Cue atrocities like this:

code:
(define-syntax filter-id
  (syntax-rules ()
    ((_ str) (cond
	      [(regexp-match #px"^[0-9]{1,}$" str) "Number"]
	      [(regexp-match #px"^[A-Z0-9. -_]{1,5}$" str) "Ticker"]
	      [else "Name"]))))
:gonk:

edit: This didn't need to be a macro, but I didn't know whether I'd need some syntax modifiers, hence the superfluous syntax-rules. :effort:

Hollow Talk fucked around with this message at 21:59 on Feb 5, 2016

Amberskin
Dec 22, 2013

We come in peace! Legit!

carry on then posted:

There are people in other departments at work that work primarily in PL/X :getin:

Most of current zOS, IMS, DB2 and other IBM Mainframe stuff is written in PL/X. Actually, the PL/X source is THE definite documentation for some obscure control blocks in Mainframeland.

Gul Banana posted:

I used to be one of them! It's honestly a pretty good alternative to C

In an alternate Universe, people writes systems stuff in BLISS and PL/S, and the curly-brace based languages are a joke among drunken old farts talking about ye olde times.

Amberskin fucked around with this message at 23:04 on Feb 5, 2016

Spatial
Nov 15, 2007

This hasn't become code yet, but...

Slide 1 posted:

- Two asynchronous CPUs
- Initial code can be developed for single core - if we need, snippets can be migrated to second CPU
Yes, this sounds like a reasonable plan for multithreaded bare metal development in C... Even better, this is written on the very next page:

Slide 2 posted:

- Proprietary extension to ABP bus allows hardware peripherals to behave differently depending on CPU/DMA/debug
Welp. I'll be posting about this for years to come, no doubt about it.

qntm
Jun 17, 2009
C code:
#define IFNULL(a) (a!=(char *)NULL ? "'" : ""),(a!=(char *)NULL ? a : "NULL"),(a!=(char *)NULL ? "'" : "")

Xarn
Jun 26, 2015

qntm posted:

C code:
#define IFNULL(a) (a!=(char *)NULL ? "'" : ""),(a!=(char *)NULL ? a : "NULL"),(a!=(char *)NULL ? "'" : "")

So, what is the function call this was made to simplify? (I refuse to believe they mean for it to expand so that the commas are operators)

Munkeymon
Aug 14, 2003

Motherfucker's got an
armor-piercing crowbar! Rigoddamndicu𝜆ous.



code:
@* I had to hard-code this to work around attribute validation *@
:eng99:

Cuntpunch
Oct 3, 2003

A monkey in a long line of kings
code:
[TestMethod]
public void MyClass_Constructor_test
{
    MyClass target = new MyClass();
}
:airquote:Unit Testing!:airquote:

Subjunctive
Sep 12, 2006

✨sparkle and shine✨

Xarn posted:

So, what is the function call this was made to simplify? (I refuse to believe they mean for it to expand so that the commas are operators)

Yeah, can you give an example of a call site? It's baffling.

gr0wl
Nov 19, 2003
SMOKE WEED EVERY DAY!!!11

Xarn posted:

So, what is the function call this was made to simplify? (I refuse to believe they mean for it to expand so that the commas are operators)

I thought for initialising the elements in an array, rather than a function call maybe? Horrid, in any case.

eth0.n
Jun 1, 2012

Xarn posted:

So, what is the function call this was made to simplify? (I refuse to believe they mean for it to expand so that the commas are operators)

My guess would be something like:

C code:
char *x = /* something */;
printf("x = %s%s%s\n", IFNULL(x));

New Yorp New Yorp
Jul 18, 2003

Only in Kenya.
Pillbug

Cuntpunch posted:

code:
[TestMethod]
public void MyClass_Constructor_test
{
    MyClass target = new MyClass();
}
:airquote:Unit Testing!:airquote:

I keep thinking I should write a code analysis rule to find unit tests with no asserts, or asserts that are like Assert.IsTrue(true)

Subjunctive
Sep 12, 2006

✨sparkle and shine✨

eth0.n posted:

My guess would be something like:

C code:

char *x = /* something */;
printf("x = %s%s%s\n", IFNULL(x));

That doesn't work with the parens though.

raminasi
Jan 25, 2005

a last drink with no ice
I'm working with a 3D modeling plugin API that has a hook called BeginSaveDocument and another called EndSaveDocument. There's no detailed documentation, but that seems pretty straightforward, right? One fires right before a document is saved, and one fires right after.

But something wasn't working. In my EndSaveDocument handler code, if the document had never been saved before, it wasn't present at the place it should be. It wasn't a race condition; I could hang my handler execution forever with the debugger, and the file would only appear after it had completed. EndSaveDocument seemed to be firing before the save.

So I post on the developer forums, saying I think I found a bug. I included a little test case. "Nope," was the official response. "It works correctly, I just checked the code. It fires after the save. I don't know why you think otherwise."

I figured it out several months later, browsing another thread on their forums. You see, when the program saves, it saves to a temporary file first, and then moves the file to the requested save location, presumably to avoid clobbering old data if there's a problem. This is all well and good. And it turns out EndSaveDocument does fire after the save!

But it fires before the file is moved to the correct location. And there's no way to get the temp file location.

The officially-recommended workaround is to watch the filesystem on a separate thread.

Plorkyeran
Mar 22, 2007

To Escape The Shackles Of The Old Forums, We Must Reject The Tribal Negativity He Endorsed

Subjunctive posted:

That doesn't work with the parens though.

There aren't parens around the commas.

Subjunctive
Sep 12, 2006

✨sparkle and shine✨

Plorkyeran posted:

There aren't parens around the commas.

Oh, quite right!

KernelSlanders
May 27, 2013

Rogue operating systems on occasion spread lies and rumors about me.

Cuntpunch posted:

code:
[TestMethod]
public void MyClass_Constructor_test
{
    MyClass target = new MyClass();
}
:airquote:Unit Testing!:airquote:

We have a rule that every bug fix must include a unit test for a regression on the fix. If someone committed something that caused the default constructor to throw an exception, this would be a reasonable test (not great, but reasonable) test for such a regression. I would worry, though, about a smart compiler skipping the unused constructor call though. Most assertions would look pretty stupid though: target is not null, target.tostring returns a string, etc. and don't make it clear what you're actually testing.

Linear Zoetrope
Nov 28, 2011

A hero must cook

KernelSlanders posted:

We have a rule that every bug fix must include a unit test for a regression on the fix. If someone committed something that caused the default constructor to throw an exception, this would be a reasonable test (not great, but reasonable) test for such a regression. I would worry, though, about a smart compiler skipping the unused constructor call though. Most assertions would look pretty stupid though: target is not null, target.tostring returns a string, etc. and don't make it clear what you're actually testing.

Yeah, but that's what comments are for. Tests like that are spurious when its purpose isn't documented, but you're right that they can be justified.

One nice thing is that some testing frameworks have blackbox(T) functions that are meant to trick the compiler into not ignoring a value for reasons like the optimization concern you mentioned.

toiletbrush
May 17, 2010

Ithaqua posted:

I keep thinking I should write a code analysis rule to find unit tests with no asserts, or asserts that are like Assert.IsTrue(true)
I once worked on a project known to be a bit ropey where the lead insisted that their unit test coverage was really high. He was right too, it was pretty good, the only thing was there wasn't a single assert in the whole lot. Every test was "try something...did it crash? No? welp...that's good enough for me!"

Cuntpunch
Oct 3, 2003

A monkey in a long line of kings

KernelSlanders posted:

We have a rule that every bug fix must include a unit test for a regression on the fix. If someone committed something that caused the default constructor to throw an exception, this would be a reasonable test (not great, but reasonable) test for such a regression. I would worry, though, about a smart compiler skipping the unused constructor call though. Most assertions would look pretty stupid though: target is not null, target.tostring returns a string, etc. and don't make it clear what you're actually testing.

Am I missing something obvious? Because let's say you do have a default ctor that blows up loudly. Doesn't that tend to result in an exception being thrown. And since the test isn't try/catching, even if you did:

code:
[TestMethod]
public void Constructor_Test
{
    var foo = new MyClass();

    Assert.IsNotNull(foo);
}
The test would fail because of an unhandled exception, rather than *actually* being able to Assert about the state of foo, post-construction?

KaneTW
Dec 2, 2011

Xarn posted:

So, what is the function call this was made to simplify? (I refuse to believe they mean for it to expand so that the commas are operators)

The real horror is a missing set of parens around a.

MisterZimbu
Mar 13, 2006
I like writing custom assertion helpers, then unit testing those, because I get to write:

code:
Assert.Fail("Assertion did not fail.");
I am absolutely awful at unit testing. Can't figure out how to do things in a maintainable way and with minimal headaches for the life of me :(

Space Kablooey
May 6, 2009


Cuntpunch posted:

Am I missing something obvious? Because let's say you do have a default ctor that blows up loudly. Doesn't that tend to result in an exception being thrown. And since the test isn't try/catching, even if you did:

code:
[TestMethod]
public void Constructor_Test
{
    var foo = new MyClass();

    Assert.IsNotNull(foo);
}
The test would fail because of an unhandled exception, rather than *actually* being able to Assert about the state of foo, post-construction?

A failure because of an uncaught exception is still a failure. Having the assert there is not needed, true, but having it there makes the intention of the test clearer.

Sebbe
Feb 29, 2004

KaneTW posted:

The real horror is a missing set of parens around a.

Also, a gets computed 3 or 4 times. Fun with macros.

carry on then
Jul 10, 2010

by VideoGames

(and can't post for 10 years!)

My favorite test I've seen was called AlwaysPassesTest()

qntm
Jun 17, 2009

Xarn posted:

So, what is the function call this was made to simplify? (I refuse to believe they mean for it to expand so that the commas are operators)

C code:
		rows = DoDBQuery(AutonomicRegistration.StructureSet, (SESSIONCACHE *)NULL, (ANCESTRY *)NULL, AutonomicRegistration.Connect, SQL_INSERT, &LoadIssue, OPER_INFO, NULL, AutonomicRegistration.MultiLogger, NULL, NULL, NULL, NULL,
			"INSERT INTO AUTONOMIC.LOADISSUE (Loader, Stream, Cause, CauseText, Attribute, Value) VALUES (%d,%s%s%s,'%s','%s',%s%s%s,%s%s%s)\n",
				AutonomicRegistration.Loader, IFNULL(AutonomicRegistration.Stream), Cause, ExceptionText, IFNULL(Attribute), IFNULL(Value));	

ninjeff
Jan 19, 2004

HardDisk posted:

Having the assert there is not needed, true, but having it there makes the intention of the test clearer.

Really? That just makes me think that the writer thinks constructors can return null.

Adbot
ADBOT LOVES YOU

MisterZimbu
Mar 13, 2006

HardDisk posted:

A failure because of an uncaught exception is still a failure. Having the assert there is not needed, true, but having it there makes the intention of the test clearer.

Isn't that better served by naming the test appropriately and/or leaving a comment saying "make sure we don't throw an exception"?

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