« first day (1543 days earlier)      last day (3388 days later) » 

12:00 AM
@R.MartinhoFernandes I admit to emotionally reacting to assembly form being used as an argument
 
@BartekBanachewicz It wasn't
 
@BartekBanachewicz Well, higher performance has it's limits as a value proposition, but you'll find it hard to sell a phone that is not responsive and has a battery life of one minute. Obviously that's a tad extreme, but those things do matter.
 
@BartekBanachewicz It was used as an example of a level where immutability is - currently - indispensible
 
Yes, but those are all your assumptions.
 
@sehe right
@Puppy Since when are we talking about phones in particular?
 
12:01 AM
Wooo! I finally got GitHub to work.
 
I simply picked them as an example, since it's the only place I know of where a hardware JVM would be remotely feasible.
 
Erlang exists and it has seen commercial applications. When it was being designed, I bet a fair few people thought/said/cried "That's not practical"
 
Dataflow architecture is a computer architecture that directly contrasts the traditional von Neumann architecture or control flow architecture. Dataflow architectures do not have a program counter, or (at least conceptually) the executability and execution of instructions is solely determined based on the availability of input arguments to the instructions, so that the order of instruction execution is unpredictable: i. e. behavior is indeterministic. Although no commercially successful general-purpose computer hardware has used a dataflow architecture, it has been successfully implemented ...
5
 
> Although no commercially successful general-purpose computer hardware has used a dataflow architecture, it has been successfully implemented in specialized hardware such as in digital signal processing, network routing, graphics processing, telemetry, and more recently in data warehousing. It is also very relevant in many software architectures today including database engine designs and parallel computing frameworks.
 
@R.MartinhoFernandes Wow. Thanks robot. There's something to really read.
 
12:03 AM
Took me a while to remember the right keywords to find that.
 
hm, that sheds new light (for me) on why Haskell might be the right language to program GPUs and DSPs
 
GPUs might be a good fit in the future.
 
I was specifically hinting at this here but I'd never seen a thing like it. So thanks again!
21 mins ago, by sehe
But, in the end, even the purest immutability involves changing state. If only because the state always expands. And expansion/growth can be seen as change.
I'm off to bed
 
@sehe Nighty night.
 
@sehe Did someone already nitpick that nonsense to death?
 
12:07 AM
but right now I think they are very resource constrained and it's hard enough to get shit done on them in many cases even with maximum register-shitting-around-with.
 
@LucDanton Nope. Of course it's definitions, at least the way I meant it there
 
Ell
There will always be change of state because we model the world and the world changes
 
Bartek, if you claim that using goto is a bad idea in all cases, you claim that especially for toasters, washing machines and smartphones
 
@HansKlünder do I?
 
thus it's a valid point to check if for smartphones
Yes, if you claim it for all cases, toasters re included.
 
12:09 AM
yes. They're not "especially" picked though.
 
Would be different if the claim was: goto is a bad idea in the very most cases.
 
@DietmarKühl did you have anything to do with this? I found it interesting that it popped up after you mentioned you should explain property mapping better?
 
@sehe Pick any system that won’t let you notice the 'expansion' as you put it and you’re done. (I recommend you pick some safe Haskell.)
 
ok, that's true.
they are just included.
 
But yeah definitions, sure. That does make the 'insight' unhelpful though.
 
12:10 AM
@LucDanton I was talking about hardware though. And yes, this is what I meant
 
However, still a smartphone which sells better doe to a longer battery life due to a clever use of goto would be a valid argument.
 
FTR I'd use an analog circuit for a toeaster
 
Pick hardware with unbounded memory!
 
@HansKlünder why don't you simply go to the low-level programming?
if you're writing assembly by hand, jmp is perfectly acceptable
 
Bartek, that's fine - just, if anybody develops cheaper toasters using goto in digital circuits for them, that would be a point.
 
12:12 AM
See, I don't mind unconditional jumps in low-level code.
 
@LucDanton Mmm. Not sure. In the light of hardware, the bounds of the state should always be visible, because resources aren't infinite. Well. Perhaps. If you can just "stop time" - logically the processor would not make any error, it would just not have the same runtime
 
Ah - that's a good question, Bartek, and I appreciate that your are interested in my personal preferences
 
@LucDanton I'll put that on the list (cough)
 
@HansKlünder You don't use goto in digital circuits. You use gates and shit.
 
I have a deja vu
and a very strong one
 
12:13 AM
I can use goto in software running on chips build by digital circuits.
 
But then the chips are not relevant.
 
Bartek, it's not generally true that I don't go to low level programming. Sometimes it's the best way to achieve a goal. In most cases, however, I work more efficient using high level languages.
 
Ell
I wonder what the best way to encode a conversation in a chess game is
Let's say you want a secret conversation
 
Nobody cares about separating levels of abstraction anymore.
Hobby horses would fade and go out of reach.
Trauma ensues.
 
The really cool thing about software is that you can solve the problem at different levels and have the solution transformed to the appropriate one.
 
12:15 AM
Like the toddler going to pre-school; everything is fine as long as Teddy can come.
 
The point is that goto might be part of a software that runs on a toaster.
 
Ell
So you play a game of chess with someone, the two players are the only people that can understand the message
That'd be a good film or something
 
@HansKlünder It doesn't have to be part of the source code.
 
Really, R. M.?
 
50 secs ago, by R. Martinho Fernandes
The really cool thing about software is that you can solve the problem at different levels and have the solution transformed to the appropriate one.
 
12:15 AM
@HansKlünder The real point is that it might not be, because it's Haskell, translated to your toaster
 
Toasty!
 
34 mins ago, by sehe
@Puppy The fact that problems, theorems, whatnot can be transformed from one domain to another doesn't essentially change them.
That was 30x longer back :)
 
R.M., I have seen low level solutions that I very much doubt could be done high level and then transferred without creating much more efort
 
(This is the itchy bone for the robot, I feel) You haven't looked at the optimized output of GHC enough
 
And I have seen some that I don't doubt could be done high level and then transferred without creating much more efort.
 
12:17 AM
sehe, there might be a toaster manufacturer that wants to use a very cheap embedded computer, not able to run haskell.
 
@HansKlünder There are no machines able to run Haskell anywhere, AFAIK.
 
@HansKlünder You're missing the point. The toaster can run your stock RISC whatever
 
You're still missing the whole point.
 
Is it okay if I use a goto to break out of a nested loop?
 
@HansKlünder Freestanding environments
 
12:18 AM
I am not.
 
@Nooble lol
 
@HansKlünder Then why mention "not able to run haskell"?
 
What kind of e-mail is {ezyang,⊥}[at]cs.stanford.edu?
 
@milleniumbug I'll take that as a no.
 
Every programmable machine is able to run at least some programs written in Haskell.
 
12:19 AM
@LucDanton including interpunction, or is this pseudo LateX?
 
It's simplified for "not able to run a haskell program transferred to a toaster".
 
@HansKlünder So, what is it able to run? Does it require certified programs, proven to contain the keyword goto in it's source? Because, what's the difference?
 
@HansKlünder So the toaster can't run programs in toaster language?
 
@sehe Only change I made is substituting [at], otherwise it’s verbatim.
 
@LucDanton I am not aware of any.
 
12:20 AM
The Haskell/brainfuck/whatever is gone once you have the solution in toaster language.
 
@LucDanton It's a wicked one :)
 
R. M. the toaster might have very limited flash memory.
As well as very limited RAm.
 
I fail to see the point.
 
@HansKlünder a.) Embedded can run assembly. b.) Freestanding C compiler can translate code to assembly. c.) Toasters are simple state machines. d.) State machines are simple to implement in Haskell. e.) Haskell can be translated into C.
 
I smell nonsensical assumptions.
 
12:21 AM
@sehe Anyway, I’m seeing a few papers on Haskells with resource/memory bounds (re: translation). Kind of a fresh area with little to show for it yet IIRC though.
 
Yup the strawman being "Haskell requires huge runtime and is bloated"
 
@Nooble Every time I thought "hmmm, this would be an excellent time to use goto to break out of the nested loop", I managed to muck around for 2 minutes, and refactor that into separate function.
 
It's /just/ a strong typed general purpose language. All of those can be translated into equally small binaries given the right compiler.
 
@milleniumbug, I have seen cases in which an additional function would be too expensive.
 
12:23 AM
Your code will thank you for that.
 
you know
 
The strong typedness of course giving the compiler enormous amounts of leeway to optimize
(contrast with "hand optimized C"; once you go there and dip into the evil goto's, you're toast. The compiler has little choice than to faithfully follow your imperatives and cannot optimize nearly as much)
 
@HansKlünder Doesn't matter. Optimizers exist.
 
the fact that you can't capture by const& in lambdas is pretty bad
 
Like, a bootloader that has 512 bytes of memory only.
 
12:25 AM
@milleniumbug And optimizers work well with code that doesn't use goto :)
 
@Nooble sigh
 
@Nooble I don't use nested loops. At least not nested loops that are coupled together such that you want to leave both at once.
 
@BartekBanachewicz I thought in c++14 that should be possible, right? Wasn't it [X const& x = outerX](){ /*bla*/};?
 
@Quentin cont. Of course that just assumes the Standard Library approach should be preferred here; one might question its choices, and rightfully so. So what's gained with that approach? For one, the fact that ar isn't modified by the loops is more clearly expressed when using an appropriate algorithm. This might seem less clear in my answer, because I capture ar by reference into lambda scope. Unfortunately, it's impossible to capture by const& in C++11, but I believe it changes in C++14. — Bartek Banachewicz 5 mins ago
@sehe I certainly hope so
 
I still don't see how several nested function calls would, without additional cost, replace a goto that braks out of several levels of loops
 
12:26 AM
define "additional cost"
 
@HansKlünder Simple: the cost is only in your head.
 
For example, an executable code that is 10 bytes longer.
 
45 mins ago, by sehe
@Puppy The fact that problems, theorems, whatnot can be transformed from one domain to another doesn't essentially change them.
 
That is additional cost.
 
Still hitting on the same key.
 
12:27 AM
9 mins ago, by sehe
(This is the itchy bone for the robot, I feel) You haven't looked at the optimized output of GHC enough
 
And in some cases these 10 bytes matter a lot.
 
@HansKlünder functions are (can be) completely eliminated by the optimizers, so I don't think it really matters
 
Fortunately, these cases are rare.
 
@HansKlünder Just don't put them there.
 
@HansKlünder Or, 10 bytes shorter. With your handwritten optimizations, you'll never know
 
12:28 AM
Bartek, that still does not explain how jumping out of several nested loops should be achieved by use of nested functions.
 
Your whole argument rests on the assumption of a compiler that can't do trivial inlining.
 
No, R. M.
 
and TCO
 
Not at all.
 
@HansKlünder you don't have to nest functions. Simply don't use (nested) loops at all.
 
12:29 AM
@HansKlünder Then where do those 10 bytes come from?
 
You, R.M., have the assumption that using nested functions can replace goto without any additional cost.
 
I can show it to you.
 
@HansKlünder It's a solved problem with proven implementations.
 
Bartek, there are cases in which using nested loops is the cheapest solution.
sesh, without additional cost? The executable won't grow a single byte?
 
@HansKlünder You mean, using nested loops isn't more expensive than using nested functions
 
12:30 AM
Yes
 
@HansKlünder It's an equivalent program. Why should the compiler output be forcibly different?
There's no overriding reason for the result to be different.
 
R.M., you still did not explain how to replace a goto by nested function calls, but you already claim that it is the same program
 
There are only practical reasons, namely compilers not smart enough to realise it is the same program.
 
@HansKlünder by short-circuiting fold.
 
whoosh - needs a FP glossary to get that
 
12:32 AM
by a higher-order operation that can automatically end when the predicate succeeds
which can be implemented as nested loops with a goto for all I care, but that doesn't need to litter usercode
 
Bartek, I have the impression that you refer to a term that is mainly used with Haskell.
 
it's really not.
 
@HansKlünder The transformation is well-known and rather trivial: put the loops in a function, replace goto with return.
 
R.M.. how can return know that it hast to jum 3 functions back?
 
12:33 AM
it's just one function
 
How will retirn know to skip 2 frames?
 
It doesn't have to jump three functions back.
 
But goto jumst out of 3 loops f I want
 
1
A: Breaking Out Of Nested Loop C++

Bartek BanachewiczCall those as a subroutine and return the result: bool flag = [&ar]{ for(int i =0; i<3; i++ ){ for(int j=0; j<4; j++) { if( ar[i][j]==0){ continue; } else { return false; } } } ...

 
@HansKlünder And return jumps out of three loops if you three loops there.
 
12:34 AM
if you word
 
@HansKlünder And more importantly, trivial inlining pass will result in no frames anywhere to be seen.
@HansKlünder Write some fake nested loops with goto, and I'll show you the equivalent.
 
Bartek, that means that for every level to jump back, there is a result to be checked
a flag
 
ok, lets do these fake nested loops, and I am courious to see the replacement.
 
yep. do it.
 
12:36 AM
Don’t you have the conditional/check for the goto anyway? Or is it psychic?
 
@R.M admittedly monadic (stateful) folds are weird
 
Bartek, I see that returning from a single function that contains all the nested loops can be a replacement for a goto in some cases.
 
@HansKlünder Please show me a case where it can't.
 
Yes, it's not a replacement for a case where you're not jumping out of nested loops.
Which isn't impressive.
@HansKlünder I know the use case you should be mentioning, btw: it's a state machine. The same arguments against that use still apply, but they're a lot weaker because the transformation is no longer trivial.
 
for ( int i=0; i<3; i++) for (int j=0; j<3; j++) { for (k=0; k<3; k++) { if (k==1) goto l1; if (k==2) goto l2; } } l1: } l2: }
 
12:40 AM
The first goto is spurious.
It's a continue.
Or a break.
I can't see properly without indentation.
 
ok, let me indent it, takes some minutes.
 
not in chat please
 
yes, not here.
 
the parens are wrong
 
I do the indentation somewhere else and then I lern to put a link into the chat.
And I also correct the parentheses.
 
12:42 AM
Wait, is @Hans trying to convince you guys goto is any good?
 
@Griwes yep
@HansKlünder there
 
lol
 
Griwes, thatÄs my experience - I saw cases in which a few bytes of executable were considered expensive, and not using goto would have cost a few bytes.
 
12 mins ago, by R. Martinho Fernandes
There are only practical reasons, namely compilers not smart enough to realise it is the same program.
 
So in the meanwhile, grab this: explosm.net/rcg
 
12:44 AM
I am not trying to convince anybody. However, I am not convinced that goto is useless just because all problems can be transferred to haskell and from there to any hardware that is able to run a program at all.
 
@HansKlünder Edge cases and bad compilers.
 
Griwes, first of all, there is nothing like "meantime".
 
In C++ there's probably literally one case where goto makes sense, and it's breaking out of multiple levels of loops. Which you shouldn't've had in the first place.
 
Since I will create an example, and I amrunning just a single brain, I have no spare brains to grab somthing else during the tim.
But after that, it would be a nce idea.
 
12:45 AM
Next - Griwes, that is just the case that you friendly commented with "lol"
I wrote about exactly that case.
Now you first lough about me for that
and then tell me that that is the only case where it is useful.
 
I commented on the general idea of saying "goto is any good".
The one case I mentioned is only somewhat reasonable.
 
Thanks for the link, Griwes, I like that one very much.
 
As I said, if you have nested loops, chances are you are writing horrible code.
 
^
and with that, I'm leaving you
 
Grives, I opposed against the statements that ALL gotos are bad.
 
12:47 AM
don't use nested loops
 
All gotos are bad.
 
don't use fucking loops while we're at it.
 
goto Considered Harmful
 
A valid proof against that statement is one single case where goto is good.
 
@BartekBanachewicz Now, now, let's not go that far. :D
 
12:47 AM
One case in this world.
 
OK, I went to Tesco and the club. Anne gets back from darts, (arrers), with a story. Aparrently, on new-years eve, at roughtly 11:30, 'AG', (name initialised to protect the monumentally stupid), asked for some help with his home computer system. It seems that my response did not go down well - his wife and daughter heard some 'less-than-cooperative phrases'. Now I'm shagged - I have to apologise for someone else's moronicity, (is that a word?).
 
for loop Considered Harmful
 
Not really.
 
@Griwes why not?
 
Nested loop considered harmful.
 
12:48 AM
99% of the time loops can be converted to higher-order manipulators easily
 
@BartekBanachewicz Because sometimes iterations are really easier to process in human brain than recursion or whatnot.
Is that a correct use of "whatnot"?
 
I'm not talking about recursion
I'm talking about transform and accumulate
 
Bartek, I am fine with that "99"%" statement.
 
@BartekBanachewicz Yeah, sure.
 
a.k.a. map and reduce
 
12:49 AM
With that I do agree 100%.
 
@HansKlünder Yes, and nested loops isn't one.
 
I was under the impression that you consider ALL gotos to be bad.
 
@Griwes There is no correct use of "whatnot".
 
@HansKlünder I do
 
@JerryCoffin Whatnot considered harmful?
 
12:49 AM
@HansKlünder Outside of assembler, they are.
 
@HansKlünder if you absolutely have to use nested loops for whatever bad reason, use a function and return from it
 
Ok, I have to write the nested loop - I'll be back
 
@Griwes I suppose that depends on who's doing the considering in question.
 
@JerryCoffin Hah.
 
^^ what Bartek says.
 
12:51 AM
Is there a warning somewhere, be it in clang or gcc, that yells at me for defining not template, not inline (not static?) functions in a header?
 
Shit, that's twice today I've agreed with Bartek :(
 
(Don't ask why I need that. Please. :D)
 
@MartinJames "assembly language". An "assembler" is a program that assembles assembly language into object code, roughly congruent to a compiler compiling code in some higher level language.
 
You are doing it to find functions defined in a header.
 
@LucDanton Captain.
Hmm. How do the answers on the unconference poll look like? :P
 
12:52 AM
@Griwes Doubt it: what's a header?
 
@Griwes I’m not aware that GCC cares what is a header and what is not. So probably not.
 
@Griwes Well, the compiler needs to know it's a header
damn, too late
 
@R.MartinhoFernandes Something that got #included in a TU I'm compiling.
 
@JerryCoffin There are conditionals, calls and jumps. That's it. Assembler is architecture-dependent. 'goto' is unavoidable.
 
@BartekBanachewicz In this case what's almost certainly desired is some sort of segmented iterator, so a single level of loop traverses all the elements in a 3D (or whatever number of dimensions) matrix, and then you just do something like return std::any_of(matrix.begin(), matrix.end(), your_condition);
 
12:53 AM
@Griwes That requires preprocessor–compiler interaction. Which is not entirely outlandish mind you, but once again not something that GCC cares about.
 
@LucDanton Well, both clang and gcc do print "include stacks" when an error arises... :P
 
Hence 'not entirely outlandish'.
 
Ell
Can I have a link to the poll?
 
Decades without 'goto'. Not feeling deprived yet..
 
12:55 AM
There is an unconference poll??
 
It actually makes sense...
 
@MartinJames See the top pinned item.
 
If so, anywhere but UK.
 
Also, filename.
 
12:55 AM
@R.MartinhoFernandes :D
 
That's an example goto jumping out of a nested loop.
 
Actually, there are 2 jumps, skipping a different number of levels.
 
Alright, so you are three levels of iteration deep.
 
Wow, loungers don't notice the pinned message. Now, all the newbies are excused then.
 
12:56 AM
Why do you even need that?
 
Griwes, that's not the point here.
 
Yes it is.
 
Ell
I'm on mobile so I can't see it.
 
For your example to mean anything, it must actually - gasp - mean something.
Also please start following the PSA.
 
R.M. claims he can replace that by code that does not need goto and produces an executable that is not bigger.
What is the PSA?
 
12:58 AM
Public Service Announcement.
 
I really like your PSA
 
Then start following it dammit.
@HansKlünder What does that code even do?
 
Griwes, why so rude? It's a funny picture.
 
52 secs ago, by Griwes
Then start following it dammit.
 
12:59 AM
There is no way I will follow that picture you showed me.
But I like the picture.
 

« first day (1543 days earlier)      last day (3388 days later) »