Conversation started Jan 16, 2017 at 19:09.
Anonymous
Jan 16, 2017 19:09
Well my primary goal with the language is to make it effortlessly parallel
Anonymous
Scalability is a big design goal
Anonymous
Which means solid, simple support for asynchronous tasks
oh, so like Go?
Anonymous
And not in a stupid way like Node where everything is asynchronous, even if you don't want/need it to be
(also, well done starting out with your goals. It's always nice when people start out with those instead of a bunch of syntax)
Anonymous
Jan 16, 2017 19:11
@NathanMerrill My experience with Go is very limited
Anonymous
So maybe?
Goroutines are pretty nice
Anonymous
One of the things I'd like to do is make each "function" (or whatever they end up being called) portable and serializable, so that it's easy to dispatch them concurrently (even across multiple processes, cores, or computers)
Anonymous
@quartata That seems kinda like what I want
Anonymous
I'm not a huge fan of the Go syntax, though
Jan 16, 2017 19:15
Me neither.
portable and serializable? so like you take a function, serialize it to a string, and anywhere you send it can run that function?
Anonymous
@NathanMerrill Not necessarily a string, but yeah that's the gist of it
That's something Pytek will be able to do eventually.
Go syntax is unnecessarily complicated in my opinion... that's why I never learned Go.
so can functions not contain references to outside variables?
or are those variables "saved" at the point of serialization?
Jan 16, 2017 19:17
@EriktheOutgolfer Actually I find it quite the opposite: it's too simple. Type signatures in particular I find hard to read with no separator between the types and the variable name.
or do you make a distinction between the purity of a function?
Anonymous
@NathanMerrill That would be a decision I'd have to consider. On the one hand, it'd be nice to be able to reference nonlocal objects, but the serialization would be much harder, and synchronizing state would be difficult.
0
A: Sandbox for Proposed Challenges

endriklos977Challenge: Print number of possible values of X if: X is dividable by 3, X contains the number 3 and input() < X < 10000 X is dividable by 7, X contains the number 2, X doesn't contain the number 3 and input() < X < 5000 Sub-Challenge: Do the same but instead of printing the number, print the v...

@Mego synchronizing state would be impossible. If you want it to be scalable and "send-anywhere", then you have to make it a 1-time-send
@NathanMerrill It would have to be pure, yes.
Although obviously you can send just a stub if all you want is RMI.
Anonymous
Jan 16, 2017 19:18
Being able to modify nonlocal objects would mean synchronization locks would be necessary, which would require a centralized monitor, which conflicts with my vision of a decentralized network
there are more ways to modify non-local objects than assigning though
like, if you have objects, and a method assigns a variable within the object
so, if you want the ability to reference outside variables, I think you either have to take a snapshot of the current state, or you have to require that the function is pure
Anonymous
@NathanMerrill Sure, but you would still need locks and a monitor for that. You'd need a centralized authority to decide which unit gets the lock and thus gets to modify the state.
Anonymous
I think what I would end up doing is allowing each processing unit to have its own state variables, but not allow processing units to modify each others' state (unless a centralized monitor was explicitly set up by the programmer for that purpose)
Anonymous
Each unit would be responsible for maintaining its own state. The only way its state can be changed is if the unit changes the state itself.
...how does that work? I'm assuming you can boot up a processing unit at any time. Does it copy state at that point in time?
Anonymous
Jan 16, 2017 19:24
@NathanMerrill The unit's state would basically be thread-local variables. How the state is initialized is up to the programmer.
so, each time I "boot", it starts with the same local variables
Anonymous
When functions are passed, any data from the unit's state would be copied (and thus modifications to that data wouldn't modify the unit's state)
ok, so what's the purpose of function passing?
I'm assuming both machines have access to the same code
Anonymous
@NathanMerrill Essentially yes. Each time a unit starts up, it starts with a clean slate. Any previous state would have to be saved and restored via local serialization.
Anonymous
@NathanMerrill Think of it like the processing unit saying "I need this computed, but I can't do it myself, so someone else take care of it"
Anonymous
Jan 16, 2017 19:27
It would then pass the function to the other units, and any available units would run the function and send the result back.
Anonymous
It doesn't matter if a function gets computed by multiple units, because pure functions means no side effects, so every unit will compute the same result. The unit that requested the async computation would just take whichever result was done first.
right, but usually workers are doing a single task, and simply need to be passed the values to the function, not a function itself
like, if you are sending out 50K tasks, then you're sending out that same function 50K times, instead of just the data
Anonymous
The different units wouldn't necessarily all have the same code - I'd want the ability to do dynamic code generation, so one unit can create a function that the other units wouldn't have.
That doesn't seem super useful to me. That said, I haven't worked much in the scaling-application world, so I may be totally wrong
I said "much", I mean "at all"
(specifically the need to dynamically create the task to work on, as well distribute that task in a parallel fashion)
Anonymous
Well, look at it this way: Unit A and B both have the same program loaded. However, Unit A runs function F, and Unit B runs function G. In function F, a new function H is created, and Unit A sends out an async request for running H with some set of parameters. Because Unit B hasn't run function F yet, it hasn't defined function H, so it would need the code from Unit A in order to run the function.
Jan 16, 2017 19:34
right, I get how it works, but from my perspective, workers are usually doing the same task over and over, just with different numbers/parameters
but I may be totally wrong
Anonymous
@NathanMerrill That's the typical approach to concurrency. I want to allow other approaches as well - workers running different tasks that cooperatively solve one larger problem, for example.
right, And for all we know, this may be the next big thing in concurrency. Just because it isn't done that way doesn't mean it won't solve a bunch of problems programmers are currently dealing with :P
Anonymous
Say you want to decide if a number has two different properties. You would have Unit A deciding whether the number has the first property, and Unit B deciding whether the number has the second property. Whichever unit finishes first would send its result to the other and quit. Then, once the second unit finishes, it would have the result from the first unit, so it would compute the logical AND of both decisions and output it.
Anonymous
The properties could be, for example, membership in the set of primes and membership in the set of Fibonacci numbers.
right, but even then, you still have a fixed number of functions
Anonymous
Jan 16, 2017 19:39
Hmm?
you basically pass to the workers "prime 1234567" or "fib 1234567"
Anonymous
Sure, that would be one way of doing it. But depending on the properties, that could be difficult to do.
I guess I'm having a hard time coming up with a use-case for function generation that does much more than store variables into the function
Anonymous
Right now, concurrency is all about SIMD. I want to design a language that has the tools to do SISD, SIMD, MISD, and MIMD.
Anonymous
@NathanMerrill Who says there has to be a use case right now? :P
Anonymous
Jan 16, 2017 19:42
"If you build it, they will come."
lol
then I stand by what I said before:
5 mins ago, by Nathan Merrill
right, And for all we know, this may be the next big thing in concurrency. Just because it isn't done that way doesn't mean it won't solve a bunch of problems programmers are currently dealing with :P
Anonymous
And I agree with that :P
Anonymous
I didn't come up with the idea for this language because I thought "I need this to solve a problem" - instead, I thought "this would be cool to have"
isn't that why we all make languages?
because its sounds cool and fun?
Anonymous
The Rule of Cool is the highest law for programmers
Jan 16, 2017 19:46
@NathanMerrill Aye, I've seen that to be a common reason to ask if chat is dead. Thing is though, the answer is always the same: no. I frequently look at chat but don't say anything. If no one responds to you, then maybe nobody is interested at that time. Chattering about something that nobody's interested in is noise too.
@El'endiaStarman I disagree that its never dead here. If it is dead, then I'll bring it up again. If its not dead, then I know its uninteresting and I won't bring it up again
@quartata Yeah, I have it open in a tab already. I'll read it after Game Programming Patterns.
@Mego one other question, when passing a function, do you make any assumptions about functions the target computer has?
@NathanMerrill What counts as "dead"?
its human judgement, but I need to make that human judgement to judge interest as well
like, even if chat was active, I still need to judge people's responses to see if they are interested, or trying to move on
Anonymous
Jan 16, 2017 19:50
@NathanMerrill No. If you want to call another function inside of a function, it needs to be passed as a parameter. Functions passed through async requests must be pure, and cannot directly interact with the running unit's state.
@ATaco: I wrote the Threead quine you asked for: codegolf.stackexchange.com/a/107047/62131
@Mego so, if I have a large enterprise-scale application with tons of functions and who-knows-what, I may be passing a huge chunk of my app every time I send the function
not to say that that is a bad thing: it pushes programmers toward making their functions lightweight and dependency-free
but, in essence, worker threads would work without any code, ever
you could spin up a gazillion workers to accept tasks from anybody anywhere
Anonymous
Yeah, unless there's another way around it that I haven't come up with yet, passing a bunch of data and code is a necessary evil
Anonymous
So it will be up to the programmer to be as lightweight as possible
so, are you going to come up with byte-code that you pass around?
what does a function look like on the wire?
Jan 16, 2017 19:56
If you can figure out how to send diffs instead of whole pieces of data, that'd help.
Anonymous
@NathanMerrill Yes, bytecode will be used
Anonymous
@El'endiaStarman That would be a useful optimization, but it would largely depend on the format of the bytecode
Anonymous
And it would also require certain assumptions to be made (like the receiving unit has already received the function code, and hasn't lost its state due to a restart without saving)
also, I'm correct in assuming that all functions passed would be zero-parameter functions with a single return value?
Anonymous
@NathanMerrill Essentially yeah. Since the parameters are known ahead of time, application of the parameters can turn an N-parameter function into a zero-parameter function before passing it. Single return value yes, though that value could be a tuple or something similar, of course.
Anonymous
Jan 16, 2017 20:01
Another useful optimization would be locally caching function call results in each unit - repeated async requests for the same function with the same parameters would just return immediately with the cached value (thanks to pure functions)
would that really be a common use case?
Anonymous
Maybe
actually, an even better form of caching would to cache from the caller
Anonymous
@NathanMerrill That's what I meant - the async request would never actually get sent after the first time
Anonymous
Jan 16, 2017 20:03
I don't want to discourage a potential use case just because I don't think it would be used much
right, but caching isn't free
Anonymous
Right, so it would be up to the programmer to make smart choices
adding it as a feature (by prepending the function name with & or whatever) sounds like a good idea
but automatically caching all tasks sounds like a bad idea
Anonymous
And I agree
also, caching from the callee can be useful
because if you have lots of units giving out tasks
Anonymous
Jan 16, 2017 20:05
But there are some times where that is the best idea, so I want to make it possible if the programmer wants it
you could end up with different units giving out the same task
and, it'd be hit-or-miss as to whether you hit the same unit
Anonymous
That's also true
but if you did, it could immediately return
@ais523 An almost identical quine already existed...
Anonymous
So I take it you're interested in this language idea :P
 
Conversation ended Jan 16, 2017 at 20:08.