Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
| From | Don Y <this@isnotme.com> |
|---|---|
| Newsgroups | comp.lang.c |
| Subject | Re: things i would ban from clc |
| Date | 2012-03-13 16:06 -0700 |
| Organization | Aioe.org NNTP Server |
| Message-ID | <jjojtk$5ps$1@speranza.aioe.org> (permalink) |
| References | (15 earlier) <87vcm8tkpy.fsf@blp.benpfaff.org> <jjobtc$gbj$1@speranza.aioe.org> <4F5FB8C6.6030308@verizon.net> <jjoeic$nvu$1@speranza.aioe.org> <4F5FC58A.9040909@verizon.net> |
Hi James,
On 3/13/2012 3:09 PM, James Kuyper wrote:
>>> It would have been more helpful if your example had involved, as
>>> specified, a "threaded C program".
>>
>> That's left as an exercise for one of the language lawyers! :>
>
> That requires us to be able to correctly interpret Limbo code. You know
> Limbo, I don't, and I suspect that such ignorance is fairly common here.
> It should be incumbent on you, not us, to provide a translation.
A translation of the Limbo code appears at the end. Expecting *me*
to come up with a C version that uses features THAT I DIDN'T KNOW
EXISTED as of a few hours ago would be as prepostrous as me asking
you to tell me why C's approach is better than a Limbo approach --
and expecting *you* to provide that Limbo example! (assuming you've
never seen Limbo code until the same point in this thread that *I*
was informed of <threading.h>)
> Even if I were familiar with Limbo, I'm not competent to provide a
> counter-example, and never claimed to be. I've written highly parallel
> code - a quarter century ago, using a non-conforming C compiler, a
> highly idiosyncratic operating system, and a concept that I no longer
> remember the name of that was significantly different from the concept
> of threads.
> I've written ordinary POSIX threaded code - but that was just for fun,
> about two decades ago, and I never even got it running, because I had
> more urgent work that I was actually being paid to do. I've only just
> started familiarizing myself with C2011 threads; I'm not ready to write
> anything using them.
Understood.
> As the complainant, you should be competent to provide an example of the
> problem you're complaining about - without such expertise the problem
> could just be due to your lack of familiarity with the system. Not many
Exactly. I have no interest in waiting for a C2011 implementation
on <whatever> processors I need to support. I will probably never
even *work* in that environment.
> people are C2011 threading experts yet; I'd happily accept as relevant
> an example using any other well-known threading system with a C
> interface, such as POSIX threads. As I indicated above, I wouldn't be
> competent to judge your example, but other people on this forum would
> be; presumably including Ben Pfaff.
greetings(
surname: string, # parameter of type "string"
children: list of (string, int) # a list of tuples each
# consisting of a string and an int
output: chan of string # communication channel named "output"
# that conveys strings
) {
# create a string by concatenating the two string constants
# with the string *variable* passed to the function as "surname"
# pass the resulting string out the channel named "output"
output <-= "Season's Greetings from the "
+ surname + " family!\n";
# as long as the "children" list is not empty...
while (children != nil) {
# extract one the first ("head") element from the "children"
# list assigning it's component values to "firstname" and "int"
# the presence of the ':' is a syntactic shortcut that allows
# the declaration of these variables to be deduced from the
# values assigned to them (i.e., we know children consists
# of (string, int) tuples so we know "firstname" is now declared
# as a string and "age" is an int. I.e., this just saves two
# lines declaring those types as
# firstname: string;
# age: int;
(firstname, age) := hd children;
# ':' tells you that description is of the same type as the
# rvalue -- a string (since the expression on the right is
# recognizable as a string). Set the description string
# variable to the concatenation of the "firstname" and "surname"
# strings -- with a constant string (whitespace) in the middle
description := firstname + " " + surname;
# tack on the parenthetical comment indicating the child's age
# note the use of '=' instead of ":=" -- since we have already
# declared description's type
description = description
+ " (" + age + " years old)";
# pass the "fullname" (grrr... should have been "description")
# string to the communication channel named "output"
output <-= fullname;
# assign the balance (everything beyond the "head") of the children
# list to the children list variable
children = tl children;
}
}
logging(
input: chan of string # communication channel named "input"
# that conveys 'strings'
) {
sys = load Sys Sys->PATH; # a variable that holds a reference to
# a module called Sys. Sys->PATH
# is a constant defined within that
# module indicating where it is
while (FOREVER) {
# text is a string (because it's type is derived from the
# rhs type -- which is "chan of string"
# It's value is assigned from the string fetched from the
# communication channel named "input"
text :=<- input;
# use the print() member of the module referenced by "sys"
# to print a string "somewhere" (i.e., like printf)
sys->print("%s\n", text)
}
}
job(surname: string,
children: list of (string, int) # you've seen this before...
) {
pipe: channel of string; # declare "pipe" to be a communication
# channel (should have been "chan") that
# conveys "string" data types.
# create a thread that executes the "logging" function (defined
# above). Pass it a communication channel that it will use to
# watch for incoming text
spawn logging(pipe);
# create a thread that executes the "greetings" function (defined
# above). Pass it the communication channel that it should use
# to interact with the "logging" function started above. Pass
# the surname and list of children's (names, ages) to that
# function (i.e., thread) so that it has some work to do.
spawn greetings(surname, children, pipe)
...
}
I.e., anything that doesn't say "chan" or "spawn" in the above
is "application" and unrelated to the tasking aspects of the
language.
Back to comp.lang.c | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
things i would ban from clc jgk@panix.com (Joe keane) - 2012-03-11 23:05 +0000
Re: things i would ban from clc Keith Thompson <kst-u@mib.org> - 2012-03-12 10:33 -0700
Re: things i would ban from clc gazelle@shell.xmission.com (Kenny McCormack) - 2012-03-12 23:57 +0000
Re: things i would ban from clc jacob navia <jacob@spamsink.net> - 2012-03-12 18:44 +0100
Re: things i would ban from clc Don Y <this@isnotme.com> - 2012-03-12 12:26 -0700
Re: things i would ban from clc "osmium" <r124c4u102@comcast.net> - 2012-03-12 14:36 -0600
Re: things i would ban from clc Don Y <this@isnotme.com> - 2012-03-12 13:57 -0700
Re: things i would ban from clc James Kuyper <jameskuyper@verizon.net> - 2012-03-12 17:34 -0400
Re: things i would ban from clc Don Y <this@isnotme.com> - 2012-03-12 15:00 -0700
Re: things i would ban from clc James Kuyper <jameskuyper@verizon.net> - 2012-03-12 18:21 -0400
Re: things i would ban from clc Don Y <this@isnotme.com> - 2012-03-12 15:43 -0700
Re: things i would ban from clc jacob navia <jacob@spamsink.net> - 2012-03-12 23:53 +0100
Re: things i would ban from clc Don Y <this@isnotme.com> - 2012-03-12 17:17 -0700
Re: things i would ban from clc jacob navia <jacob@spamsink.net> - 2012-03-13 09:09 +0100
Re: things i would ban from clc Don Y <this@isnotme.com> - 2012-03-13 01:24 -0700
Re: things i would ban from clc Keith Thompson <kst-u@mib.org> - 2012-03-13 05:59 -0700
Re: things i would ban from clc Don Y <this@isnotme.com> - 2012-03-13 10:55 -0700
Re: things i would ban from clc blp@cs.stanford.edu (Ben Pfaff) - 2012-03-13 11:07 -0700
Re: things i would ban from clc Don Y <this@isnotme.com> - 2012-03-13 11:25 -0700
Re: things i would ban from clc blp@cs.stanford.edu (Ben Pfaff) - 2012-03-13 11:32 -0700
Re: things i would ban from clc Keith Thompson <kst-u@mib.org> - 2012-03-13 12:18 -0700
Re: things i would ban from clc Don Y <this@isnotme.com> - 2012-03-13 16:13 -0700
Re: things i would ban from clc Don Y <this@isnotme.com> - 2012-03-13 13:49 -0700
Re: things i would ban from clc James Kuyper <jameskuyper@verizon.net> - 2012-03-13 17:14 -0400
Re: things i would ban from clc Don Y <this@isnotme.com> - 2012-03-13 14:35 -0700
Re: things i would ban from clc James Kuyper <jameskuyper@verizon.net> - 2012-03-13 18:09 -0400
Re: things i would ban from clc Don Y <this@isnotme.com> - 2012-03-13 16:06 -0700
Re: things i would ban from clc "io_x" <a@b.c.invalid> - 2012-03-14 08:18 +0100
Re: things i would ban from clc "io_x" <a@b.c.invalid> - 2012-03-14 10:07 +0100
Re: things i would ban from clc Don Y <this@isnotme.com> - 2012-03-14 12:41 -0700
Re: things i would ban from clc "io_x" <a@b.c.invalid> - 2012-03-14 21:53 +0100
Re: things i would ban from clc Don Y <this@isnotme.com> - 2012-03-15 14:16 -0700
Re: things i would ban from clc "io_x" <a@b.c.invalid> - 2012-03-18 07:14 +0100
Re: things i would ban from clc Jens Gustedt <jens.gustedt@loria.fr> - 2012-03-14 10:39 +0100
Re: things i would ban from clc Ben Pfaff <blp@cs.stanford.edu> - 2012-03-13 14:33 -0700
Re: things i would ban from clc Don Y <this@isnotme.com> - 2012-03-13 14:40 -0700
Re: things i would ban from clc Tim Rentsch <txr@alumni.caltech.edu> - 2012-03-13 16:25 -0700
Re: things i would ban from clc Don Y <this@isnotme.com> - 2012-03-14 00:51 -0700
Re: things i would ban from clc Tim Rentsch <txr@alumni.caltech.edu> - 2012-03-14 14:25 -0700
Re: things i would ban from clc Don Y <this@isnotme.com> - 2012-03-15 13:40 -0700
Re: things i would ban from clc Tim Rentsch <txr@alumni.caltech.edu> - 2012-03-18 17:05 -0700
Re: things i would ban from clc Don Y <this@isnotme.com> - 2012-03-23 11:59 -0700
Re: things i would ban from clc Robert Wessel <robertwessel2@yahoo.com> - 2012-03-23 17:02 -0500
Re: things i would ban from clc Don Y <this@isnotme.com> - 2012-03-23 16:51 -0700
Re: things i would ban from clc "io_x" <a@b.c.invalid> - 2012-03-24 07:16 +0100
Re: things i would ban from clc Tim Rentsch <txr@alumni.caltech.edu> - 2012-03-27 11:26 -0700
Re: things i would ban from clc Kaz Kylheku <kaz@kylheku.com> - 2012-03-23 19:43 +0000
Re: things i would ban from clc Rui Maciel <rui.maciel@gmail.com> - 2012-03-23 19:45 +0000
Re: things i would ban from clc Jens Gustedt <jens.gustedt@loria.fr> - 2012-03-23 23:49 +0100
Re: things i would ban from clc Ian Collins <ian-news@hotmail.com> - 2012-03-24 11:54 +1300
Re: things i would ban from clc Jens Gustedt <jens.gustedt@loria.fr> - 2012-03-24 09:26 +0100
Re: things i would ban from clc gwowen <gwowen@gmail.com> - 2012-03-26 07:31 -0700
Re: things i would ban from clc Kaz Kylheku <kaz@kylheku.com> - 2012-03-24 05:45 +0000
Re: things i would ban from clc Jens Gustedt <jens.gustedt@loria.fr> - 2012-03-24 09:31 +0100
Re: things i would ban from clc James Kuyper <jameskuyper@verizon.net> - 2012-03-13 14:34 -0400
Re: things i would ban from clc Tim Rentsch <txr@alumni.caltech.edu> - 2012-03-13 16:18 -0700
Re: things i would ban from clc "io_x" <a@b.c.invalid> - 2012-03-14 08:18 +0100
Re: things i would ban from clc Tim Rentsch <txr@alumni.caltech.edu> - 2012-03-14 14:06 -0700
Re: things i would ban from clc Jorgen Grahn <grahn+nntp@snipabacken.se> - 2012-03-15 15:22 +0000
Re: things i would ban from clc Don Y <this@isnotme.com> - 2012-03-15 12:26 -0700
Re: things i would ban from clc jacob navia <jacob@spamsink.net> - 2012-03-15 21:28 +0100
Re: things i would ban from clc Don Y <this@isnotme.com> - 2012-03-15 13:49 -0700
Re: things i would ban from clc Ben Bacarisse <ben.usenet@bsb.me.uk> - 2012-03-15 16:36 +0000
Re: things i would ban from clc Don Y <this@isnotme.com> - 2012-03-15 12:16 -0700
Re: things i would ban from clc Ben Bacarisse <ben.usenet@bsb.me.uk> - 2012-03-16 00:13 +0000
Re: things i would ban from clc Don Y <this@isnotme.com> - 2012-03-15 20:40 -0700
Re: things i would ban from clc gwowen <gwowen@gmail.com> - 2012-03-13 01:52 -0700
Re: things i would ban from clc "io_x" <a@b.c.invalid> - 2012-03-13 11:31 +0100
Re: things i would ban from clc jacob navia <jacob@spamsink.net> - 2012-03-13 11:41 +0100
Re: things i would ban from clc gwowen <gwowen@gmail.com> - 2012-03-13 06:06 -0700
Re: things i would ban from clc jacob navia <jacob@spamsink.net> - 2012-03-13 15:06 +0100
Re: things i would ban from clc ImpalerCore <jadill33@gmail.com> - 2012-03-13 07:46 -0700
Re: things i would ban from clc jacob navia <jacob@spamsink.net> - 2012-03-13 19:08 +0100
Re: things i would ban from clc Ben Bacarisse <ben.usenet@bsb.me.uk> - 2012-03-13 13:20 +0000
Re: things i would ban from clc Jens Gustedt <jens.gustedt@loria.fr> - 2012-03-13 20:41 +0100
Re: things i would ban from clc Kaz Kylheku <kaz@kylheku.com> - 2012-03-13 19:34 +0000
Re: things i would ban from clc Don Y <this@isnotme.com> - 2012-03-13 16:14 -0700
Re: things i would ban from clc Kaz Kylheku <kaz@kylheku.com> - 2012-03-13 23:28 +0000
Re: things i would ban from clc Don Y <this@isnotme.com> - 2012-03-13 21:18 -0700
Re: things i would ban from clc Ian Collins <ian-news@hotmail.com> - 2012-03-13 20:19 +1300
Re: things i would ban from clc Don Y <this@isnotme.com> - 2012-03-13 01:09 -0700
Re: things i would ban from clc Ian Collins <ian-news@hotmail.com> - 2012-03-13 21:32 +1300
Re: things i would ban from clc nick_keighley_nospam@hotmail.com - 2012-03-13 01:52 -0700
Re: things i would ban from clc "io_x" <a@b.c.invalid> - 2012-03-13 11:31 +0100
Re: things i would ban from clc nick_keighley_nospam@hotmail.com - 2012-03-14 01:18 -0700
Re: things i would ban from clc Don Y <this@isnotme.com> - 2012-03-14 12:09 -0700
Re: things i would ban from clc ArifulHossain tuhin <etothepowerpi@gmail.com> - 2012-03-14 13:01 -0700
csiph-web