« first day (1652 days earlier)      last day (3290 days later) » 

11:00 PM
We don't need a try or catch block either
 
oh hey
it's On Error Resume Next.
 
And now, we can encapsulate both errors on the same level without the driving code to manage the rrors
The errors are propagated sideways
 
@Puppy I don't have a problem with using them for expected outcomes when you're really getting something out of them (e.g., a backtracking parser could use an exception to backtrack, and re-start parsing). Downright silly to use it in a case where a trivial while loop (for example) will do the job much more cleanly and directly though.
 
In such a way, I guess we can get a co-threads
 
@JerryCoffin It's not silly when you have to duplicate the loop for every caller.
that's a far worse outcome.
 
11:02 PM
@Puppy If you have to do that, you're just structuring your code badly, writing a function that doesn't do what you want it to.
 
@Puppy The idea is that we also have control over lost state
We don't make any assumptions
 
@Puppy I spent a few months working on RPC exception handling. It's probably the first time I ever succeeded in implementing a good error handling policy.
 
@JerryCoffin Right. What I want it to do is report failures. Which exceptions do and return codes don't.
@Cinch We don't want control over lost state. It's lost for a reason.
 
> Does this have all the power of a nomadic parser?
 
@Puppy It's God's Will.
 
11:03 PM
@LucDanton Not only the power, but the camels to prove it!
 
@Puppy Huh?
Often times there is helpful information that needs to be passed up the chain
 
@Cinch and which action should it take?
 
just add it to the exception object.
problem solved.
 
@jalf It depends. It may need to try to reestablish a connect, save the user's state for later, etc etc.
 
also most exceptions do not carry any useful information, ultimately.
only errors that need to be handled by the user need to carry useful information.
 
11:04 PM
@Cinch And how does the handling code know what to do? It's reacting to an error that occurred at an arbitrary point on another thread
 
-5
Q: Before you vote down

oscarThere're a lot of answers try to help people (who were downvoted) to accept the reality and live with it. Here I to give some advice to people who has downvoting privileges with some sense of humor. At the moment I have 76 reputations left and I'm ready to loose them by massive attack down-vote...

^^ lol wtf
 
@jalf The error header or register!
But the better part is that we can build more complex abstraction on this system!
 
@Cinch And what does that register contain?
 
@jalf In the current system, it would contain space for a single literal and a pointer to memory
 
An error code? Or a function pointer for a recovery function of some sort? Or a textual error message?
 
11:05 PM
@jalf That's up to you.
 
@Cinch Again, given this error header, how do I know what to do to recover from the error?
 
@jalf Well, the system allows programmers to come up with a scheme themselves. A good library would probably provide a suitable abstraction and allow for much more than the default system
 
> Check if you meet the following criteria: You have an ability to down vote
Checked.
 
@Mysticial Don't play dumb with us. You've heard the sound of butthurt before!
 
@Rapptz I read this which deals with writing parsers and unparsers in one go. It’s a different approach from 'Types don't know #' altogether. (You can check out both the submission and ocharles’ link in the comments.)
 
11:07 PM
What makes exceptions work is that when you catch an exception you have some idea of where it came from. You know that this exception, when propagating to that catch block, can be handled in this way. I don't need to worry about what this exception might indicate when thrown in 40 other places in the code base. Just what it means when it is caught here
What you are proposing is throwing away that implicit context, and instead having an effectively global error handler that can handle any error from any point in the code
Which is literally impossible to implement
 
The guy hopes to save his remaining 76 rep by posting a rant on meta.
 
@jalf Well, we can create this hierarchy ourselves
Again, we can build a C++-like exception systems by "stacking" contexts on-top of each other where one can collapse to the one beneath it if we do it that way
 
@jalf I wouldn't say impossible to implement--just impossible to do well at all. It's basically "ON ERROR GOTO", which BASIC had decades ago. It didn't work worth a damn then, and it won't now either--but its very existence proves that it's possible implement it.
 
even assuming that you're correct
 
Or, we can choose to bypass it and choose a more modular style of error-handling where we contain it within a subsystem
 
11:09 PM
you're making the user build a useful system instead of just providing what they actually use.
 
@Cinch Sure, but that doesn't make it better. You can build everything in C++ from assembly too. That doesn't mean I want to do that
 
@Puppy The user wouldn't be building this. The infrastructure people would.
 
right, which are the users of your language.
 
Ignorable error codes were such a stupid idea in retrospect.
 
@jalf The point is that it's flexible enough to be innovated and change
 
11:09 PM
@JerryCoffin Well, I meant implmenting it so that it actually handles errors appropriately
 
Exception handling could be more part of the standard library
 
@StackedCrooked Yes, they are.
 
@Cinch It's not innovative though. As Jerry says, it's basically ON ERROR GOTO. It's basically just saying "when something bad occurs, ask the Error Oracle, which knows everything about how to handle any possible error
The problem with this is that it requires the programmer to implement the Error Oracle
 
it is, in fact, the exact opposite of modular.
 
@Mysticial It's not his first time, see
-23
Q: To show downvoter's name

oscarI suggest to show downvoter's name so that we'll be able to decrease the number of unfair downvotes resulted by abusing his rights in doing so.

 
11:11 PM
@jalf The e.g. lisps/schemes that have condition systems reportedly get mileage out of it due to the dynamic typing.
 
And that is much, much harder than just implementing the catch block that knows what to do when this exception was caught here
 
and far more tightly coupling, too.
 
@jalf We don't have to do it externally
 
since adding more code means that you must change the Error Oracle.
 
@LucDanton Looks kinda neat.
 
11:11 PM
which can interact with the Error Oracle's existing code.
 
We could also attempt to fix the error internally. The point is that the system makes no assumptions
 
that is not a useful property.
all useful systems make assumptions.
 
@Puppy True that, but that means that we can create many different useful systems with a unified framework underneath
It would be multithreading safe too
 
@Cinch You could do, but it would be pointless since the unified framework doesn't offer anything of value.
see Object in Java and C#.
 
@Cinch The same is true for machine code.
 
11:13 PM
@jalf It's supposed to be a low level interface anyways
A higher-level one would be developed as well
 
LLVM IR is a low-level interface and that's way more sane.
 
user1804599
@milleniumbug lol
 
Machines are respectable beings. They act according to a code.
 
You started out saying you wanted to make something simpler and safer than C++. Now you're saying you want to remove all the simplifying assumptions that C++ and allow it to do absolutely any possible thing in every possible way
 
user1804599
connect "ws://localhost:1337/" $ \client -> do
    request client "auth" ["rightfold@gmail.com", "lol123"] $ \response ->
        case response of
            ["ok", _] -> return unit
            ["error", error] -> trace error
 
user1804599
11:14 PM
PureScript is amazing!
 
@Cinch I thought you wanted something to replace C++.
 
@jalf Uh... no. It's just another paradigm I thought about.
 
new paradigm?
 
If I were to create a language to replace C++, I'd implement heavy paradigms on top of that system
 
@rightfold It looks like ascii to me.
 
11:15 PM
Anyway, like I said before, download LLVM and try building it! That's the best way to see if your idea is any good :)
 
@Blob register-based mutlithreading
@jalf yeah I will once I have time
 
@Cinch It's an ex-paradigm that we threw away decades ago because it sucks.
 
@Puppy Lua uses it
 
@Rapptz I fortuitously learned that there is such a thing as bidirectional programming and such a thing as the bidirectional programming community not too long ago. As it turns out, I think that this is exactly what bidirectional programming is.
 
register as in machine registers
 
11:15 PM
Also Dalvik is register-based
 
what're we talking about here
 
@Cinch A) that is not any kind of actual argument, it's just an appeal to authority, and B), Lua does not use any kind of crazy global error handlers.
 
SIMD and stuff?
 
@Blob no one's quite sure
 
user1804599
Register-based machines are crazy.
 
11:16 PM
@Puppy Come on. If Lua uses it it must be good.
 
Lua and LLVM IR both also use registers, but guess what? they're actually the stack just expressed in a different way.
which might actually be underlying hardware registers.
 
user1804599
They're hard to implement, hard to generate code for, and hard to optimise code in.
 
@Cinch Dalvik isn't a programming language though. And it's not more expressive than a stack-based VM (such as .NET's CLR)
 
really there's not a lot of difference between the two systems
except that you need a stack and you also need some registers.
 
@rightfold Sounds like a great machine.
 
11:17 PM
@jalf I do believe there was some sort of speed up
 
@rightfold Tell that to LLVM IR.
 
@Cinch No
 
user1804599
They are so crazy that Malbolge, which is register-based, even has an instruction that is called the "crazy instruction".
 
or did you mean "mutable register"?
 
@rightfold Inception.
 
user1804599
11:18 PM
@Puppy Yes.
 
user1804599
That horrible stuff Dalvik and x86-64 do.
 
@Cinch Certainly not from this. Because it's an intermediate representation. It doesn't affect the high level programming language (Java doesn't care), and it doesn't affect the machine code that is actually executed (the ARM CPU doesn't care)
It's just an implementation detail along the way
 
@jalf Yeah, I guess.
I find it interesting, though
 
It's fine, and I think it provides more readable instructions than a stack-based VM
but it's not radically different
 
@rightfold I've never seen Dalvik, and x64 does a lot of crazy shit but I was not aware that "offering registers" was one of them.
 
11:19 PM
@Cinch For certain things under certain circumstances, yes. If memory serves, it mostly allowed slightly smaller code without losing a lot of speed though.
 
user1804599
But at least Dalvik has 65535 registers.
 
@jalf I think that as long as you can name the registers and you don't have to handle shit like re-using them you can be OK- like LLVM IR.
 
@rightfold Oh that's not what I meant
It's that each thread will have its own header register
 
@Puppy What's an offering register? Is that where you sacrifice to the machine gods?
 
user1804599
Just go with either SSA or stack machine. It's easy to implement.
 
11:20 PM
@jalf yes.
 
user1804599
Erlang bytecode is serialised SSA.
 
I have to say that LLVM IR ... is kinda annoying in some ways, but the SSA part is really fine.
it used to annoy me greatly but no more.
 
@rightfold Have you ever actually implemented a CPU (or been part of a team that did)?
 
in fact, I currently wish they offered more features as SSA.
 
On the old Alphas we used to do our kernel course at uni on, the offering register was on top of the case
We used to leave candy there to appease the kernel gods :)
 
11:21 PM
@rightfold But the idea is register-based
That's the experiment
I'd argue that the heap is a much more flexible data structure than a stack
 
user1804599
Speaking of registers, I might want to implement local variables in Mill.
 
@jalf I thought the "offering register" was next to the cash register, in a jar with "tips" on the side (but that's mostly an American thing...)
 
@Cinch That's true. The great thing about the stack is that it is less flexible
 
in fact
 
It imposes rules
Rules are basically what makes programming possible
 
11:22 PM
I find it fairly annoying that you cannot index into a register array with a dynamic index.
 
@jalf I could always reimplement the stack and function calls on a register
 
@Cinch You can't.
 
@Puppy With the header system I can. I load the two arguments into the header and then begin operation
 
registers are O(1) space and a stack is O(N).
so you would basically need a stack of registers.
 
If it's atomic, the system waits for the output
 
user1804599
11:22 PM
Stack machine!
 
which obviously defeats the point.
 
@Cinch I'm not sure about a register, but you can certainly implement stack-like usage of registers. Just for example, that's how SPARC works.
 
@Cinch Again, you've reinvented the way every CPU works
 
@JerryCoffin Ugh by register I just mean a regular array
continuous memory
 
load a stack pointer into an agreed-upon register, and off you go
 
11:23 PM
@jalf Right.
For example, I can implement tuples too
 
@Cinch You're just throwing words as you like, aren't you?
 
@milleniumbug I don't know what I'm doing I'm just throwing words around until i have the time to do this
 
And again, by codifying this and making it part of the programming language, rather than something the programmer has to sort out himself, we have made it about 1000x times easier to program computers. :)
 
But the idea is that I could have a virtual machine output into two read-only registers: the output literal, and the output pointer
 
@rightfold Stack machines have all sorts of problems themselves. Just for one really well-known example, they make it much more difficult to get much instruction-level parallelism. That's why (for one example) Intel has switched from the stack-based x87 architecture to register-based architecture for SSE and later floating point.
 
11:25 PM
@Cinch ITT Cinch secret uncovered.
 
Taking that abstraction away and saying "hey, if you want to be able to call functions,you'll have to reimplenent your own stack" is not going to make things easier
 
@jalf But I'll reimplement the stack
And people can come along and reinvent it better too
 
Nor does it provide a uniform standardized interface, like you said you wanted earlier. It takes that away
 
@Cinch That is not compelling.
it's in fact highly uncompelling.
 
Well function calls wouldn't be that hard
 
11:25 PM
I have far more faith in the 1000 devs that maintain LLVM
 
"everyone can do anything, and there are no rules at all" is not a useful programming language.
 
@Puppy I'll probably reimplement on LLVM or something
 
@Cinch But I get them for free with C++!
 
@jalf It's not a language. It's a base language/framework
 
"not hard" is not good enough
 
11:26 PM
then it would be impossible to do what you want, since they do not offer any kind of crazy stuff like that.
 
@jalf For the last time, IT'S NOT C++ vs RL
 
even the registers they offer are stack-based.
 
@Puppy Well duh
The CPU is often implemented with stack pointers I can't change the architecture
 
@Cinch Well, it seems to have varied a bit throughout this discussion :p
 
@jalf Let me split the two concepts
 
11:27 PM
@Cinch There's no (well, not much) magic in the stack pointer. It's just a convention. The CPU doesn't demand a stack
 
There's RL, which would be the low level, and a higher level langauge that would link to the lower level
 
It just has a handful of registers you can put stuff in. And it might offer a few convenience instructions that happen to work well with certain conventions
 
@jalf It's there, and it's what's there. I can't change that
Let's begin with the higher level stuff
 
@Cinch Yes you can.
 
In High-Level (HL), we could probably have better exception handling
 
11:28 PM
You can just say "we don't use any of the CPU's registers to store a stack pointer". Then you have a CPU without a stack
 
We'd be able to store error states and extract them needed with much less overhead
 
much less overhead?
nobody cares about the overhead involved in EH.
 
(not true)
 
@Puppy ....................................................
I just don't
Continuing, HL would also provide a more unified framework for async multithreading
We could implement everything on top of an async-based framework that's clean and can even be completely rebuilt if we discover some ground-breaking concept tomorrow
For example, futures? We can set the output register flag to see if the future is done, and then extract the information at the address pointed two by the output pointer
Atomics? We use the concurrency flag for that
 
but you still haven't described anything new. So you want an intermediate representation that's register-based rather than stack-based, which changes precisely nothing. You want to implement the same (lack of) error handling as Basic had. And you want to enforce a convention where every thread has associated with it a bit more metadata than it already has. And.... that's basically it
 
11:31 PM
@jalf It's just a reorganization of concepts
 
no it isn't
 
@Cinch At least in my experience, a lot of the overhead of throwing an exception in C++ is simply unwinding the stack--invoking the dtors of all the local objects between the throw point and the catch point. I definitely would not want to reduce overhead at the expense of that being automated.
 
@Cinch How do you see if something is done by setting a flag?
 
@jalf By default, the flag would be 0.
 
So you don't set the flag, you check it?
(And hope that someone else set it)
 
11:32 PM
@jalf I suppose
 
:)
 
atomically, obviously.
 
But that someone is only just the thread
 
So how often do you check this flag?
 
user1804599
lol futures
 
11:32 PM
@jalf However often you need to or want to
 
How are you notified when the flag's value changes?
 
@jalf You could create another manager thread on the low level and have it built into the higher level language
You could also manually check it only once, when you expect to or need to
Or you can never check if it your function is strictly noexcept
 
How are you guaranteed that the value generated by the future still exists by the time you extract it?
 
So how's the weather today? It's kind of cool and overcast here.
 
@jalf The system doesn't make any assumptions, but some sort of framework to handle this would invariably be created
 
11:34 PM
Been raining all day here :(
 
@JerryCoffin It was very hot this morning into horribly cold today.
 
Been great weather all week. As soon as the conference ended, pouring rain
@Cinch If it doesn't make any assumptions then it doesn't solve any problems either
 
@jalf What you could do is increment the future pointer like a shared mutex
 
It is not an interesting system if it doesn't make assumptions
 
@jalf Yes, but the standard library would solve this problem
And the standard library would be standard
 
11:35 PM
@jalf You obviously need to schedule longer conferences.
 
fuuuuuck.
 
Alright, so how does the standard library ensure that a variable generated by a future still exists when another thread tries to extract it?
 
I really needed to buy food online today.
 
@Puppy How hot is very hot (and how code is horribly cold)?
 
I don't care if this is done by the standard library or your low level framework or your high level framework. The functionality has to be there at some level. It has to implement some guarantees and make some assumptions somewhere
 
11:36 PM
@JerryCoffin Dunno, I didn't use a thermometer.
 
Anyway, 'night
 
@jalf It'll be at the standard library level
I gotta get going so I'll be back once I'm walking
 
@jalf It starts to sound to me like talking to somebody about string theory. Any time you point to a problem, it becomes: "well, we can just postulate the universe having a few dozen more dimensions (that you can't detect) and that'll add enough more parameters to every equation that we can fit it to our theory, no matter what result you get!
@Puppy Bummer. Oh well.
@jalf g'night.
 
I also must depart.
need to Do Stuff™ tomorrow and it's been a long day for me.
 
@Puppy Happy shopping. Actually, I should have a bit of late breakfast/lunch/early dinner...
 
11:40 PM
can't go shopping
I need to sleep
I'll have to shop tomorrow morning and then get delivery Monday evening.
 
@Puppy Good night.
 
cheers
 
k back
Um for future I'd probably create a concurrency flag value
0 for unset and 1 for set
Then I'd expose an API to increment it if it mutates the future in place
Also the thread that spawned the future could also reset it or possibly release it from reference
And then begin spawning other ones
Each thread might also be able to dictate it's own access permissions
For example, I can allow a thread control over my own state
In that way we can externalize the management of the concurrency
Additionally if someone suddenly comes up with a better future API, since it's a standard library , we can just choose to use a different interface and keep the old one if we so please while keeping backward compatibility
Mutexes could also be managed by a thread or fiber and a shared mutex would only need to increment its count
And if an error occurs with concurrency it's only a variable check away in the mutex header
The error handling api would probably just write to a space in memory and then pass a pointer to it around
 

« first day (1652 days earlier)      last day (3290 days later) »