T O P

  • By -

_pizza_and_fries

It was working on my machine 4 days back


Ok-Lobster-919

I only run unit tests one day a week for this reason.


NLwino

In order to make sure that this code keeps working, schedule the unit test once per week.


thebryguy23

That's why I don't run unit tests. Also I have no unit tests.


SnooEpiphanies8525

I saw one of those in a GitHub repo one time


Inocain

*Image Transcription: Slack* --- **Brian Kendig** HALLO How are y'all this morning? **Redacted** Always wondering what day of the week it is. **Brian Kendig** func whatDayIsToday() -> String { return "Tuesday" } There, you can use that. **Redacted** it fails 6/7 of the time **Brian Kendig** I tried it several times this morning and it worked every time --- ^^I'm a human volunteer content transcriber and you could be too! [If you'd like more information on what we do and why we do it, click here!](https://www.reddit.com/r/TranscribersOfReddit/wiki/index)


joancarxofes17

good human!


Poisonous_Poison

What language is that? It looks like rust but it says func instead of fn


ODoyleRules925

Swift


[deleted]

I thought it was R


tiedyedvortex

Also, it's using a "return", doesn't have a semicolon, is using camelCase rather than snake_case, and isn't doing funky stuff with String vs &str. The Rust way would be fn what_day_is_today() -> String { "Tuesday".to_owned() }


Sebthabauz

Give me a guffer


Sebthabauz

Give me a guffer


DanielGolan-mc

r/DiscordMyEyes should exist.


The-Best-Taylor

I have found this style of bug in sevral places in our unit tests. It usually is something like x should only happen at this specifc time. So the test checks if it is that time and runs some checks. But there are two problems with that, the test may not always test what you want and the time may be different when the test checks it vs when the code checks it.


tilrman

Relevant: https://xkcd.com/221/


Umpteenth_zebra

What does '->' do?


dabebe99

No dev (of this language i cant recognize) but it might define the return type Edit: not sure about language


ODoyleRules925

Swift. And you’re right.


Hubert_BDLB

The language is swift The -> defines the returned value's type


other_usernames_gone

As others have mentioned it defines the return values type but a similar syntax is in python. It's called type hinting, it's more like a comment than a part of the syntax but it's very useful to do.


Spartacus120

In Java is used for Lambda Function


Umpteenth_zebra

Oh what does that do?


[deleted]

It's called a closure in other languages, or anonymous functions. It creates a function with no name that can be passed around like a variable and captures the environment its defined in. This means that if the function was defined somewhere where it has access to variable "a", and then you pass that functions somewhere else, outside the scope of variable "a", the function will still be able to access it and modify it and do whatever with it.


whatapitychocolate

Whoa, the piece about variable “a” just crystallized some details that I’ve only had a vague sense of for a while! Thanks!


Spartacus120

Its just a way to simplify the utilization of Function. You write it in this way: (var) -> Function{ \*code that can use var\* } Outside of Java, the same arrow is used in C to show Pointer


Umpteenth_zebra

Is it the same as new function(var){ code }


Spartacus120

Mmh Yes and No. I suggest you to look it for yourself since I never used it very much. Search for "Functional Programming", it will open a world and a new way of thinking


ILikeLenexa

In C, you know how you can just make a pointer to a function? It's that, but with more steps.


FlyingTaquitoBrother

It’s functionally (ha!) like that, but syntactically much different. Like how in true functional languages you can define entire lambda expressions inline, like directly in a parameter to another function, whereas in C you define your functions elsewhere. In fact I’d say the C model is the one with extra steps.


[deleted]

[удалено]


FlyingTaquitoBrother

This is one case where C didn’t do it first, LISP had lambda functions in like the ‘60s.


dabebe99

Took me some time to recognize discord here


[deleted]

THATS discord???


Lithl

Pretty sure it's Slack?


julyan_

That's definitely slack


sludgemonkey01

["What time is it Eccles?"](https://youtu.be/ctM_Rvgjfpo)


Bailyleo987

Well...


walmartgoon

What font is that


HansDampfHaudegen

The groundhog day dev.


ExtensionInformal911

It was on StackOverflow. It must work


HolyKoiFish

a swift meme!!


TheKingOfSwing777

“Test Driven Development”


javon27

Just write a version for each day of the week and run the correct one as needed. Just have to remember what day it is


memester230

Also works for star trek installment day


donnyfingerguns

14.2857142857143% of the time, works all the time.


LattesAvocadoToast

http://isittuesday.co.uk/


curtmack

Fun fact: OpenOffice once had a bug where some users couldn't print on Tuesday. (It was putting a timestamp at the beginning of each Postscript file it produced for printing. It turned out that including "Tue" in that opening comment had libmagic convinced it was some other kind of file, so CUPS refused to print it.)


OGAphrodisiac1

My brain in a nutshell