[{"data":1,"prerenderedAt":685},["ShallowReactive",2],{"project-38632970":3},{"id":4,"name":5,"line":6,"line_source":7,"title":8,"url":9,"domain":10,"maker":11,"posted_at":12,"year":13,"points":14,"comments":15,"rank_in_year":16,"shown_in_year":17,"top":18,"tier":19,"category":20,"subcategory":21,"format":22,"keywords":23,"reception":29,"sentiment":30,"stance_mix":31,"scored_comments":36,"aspects":37,"strip":47,"post_text":50,"what":51,"said":97,"maker_in_thread":204,"shape":212,"grid":217,"attempts":647,"same_week":648,"maker_shows":44,"maker_hidden":677,"reader_version":678,"card":679},"38632970","CspChan","A pure C89 implementation of Go channels, with blocking selects","title","Show HN: A pure C89 implementation of Go channels, with blocking selects","https:\u002F\u002Fgithub.com\u002Frochus-keller\u002FCspChan","github.com","Rochus",1702495904,2023,271,166,176,3109,6,"legend","languages","concurrency library","library",[24,25,26,27,28],"c89","go channels","csp","blocking select","pthreads","debated",0.029,{"positive":32,"neutral":33,"mixed":34,"critical":35},15,23,0,16,54,{"idea":38,"performance":41,"docs":42,"execution":43,"design":45},{"positive":39,"critical":40},3,1,{"positive":40,"critical":40},{"positive":40,"critical":39},{"positive":34,"critical":44},7,{"positive":44,"critical":46},4,[34,34,34,48,48,39,40,40,40,34,48,48,34,40,39,34,34,34,34,34,34,34,49,46,39,39,39,48,39,48,40,40,34,40,39,40,48,46,39,39],5,2,null,{"problem":52,"audience":62,"pricing":50,"motivation":68,"time_to_build":50,"stack":72,"openness":95,"stage":96,"team_size":96},{"value":53,"source":54,"evidence":55},"Provides Go-style channels and selects in plain C89 code.","maker",[56,59],{"id":57,"by":11,"text":58},"38645264","No C89 compatible toolchain does \"pure C89\" without extra options (if at all); people would run away. Even if you use GCC or CLANG with the -std=c89 option it doesn't. So the…",{"id":60,"by":11,"text":61},"38642470","One more attempt, so that children can understand it too: imagine this title \"A pure C implementation of Go channels, with blocking selects\"; it means exactly the same; and now…",{"value":63,"source":54,"evidence":64},"C programmers needing portable channel-based concurrency on old compilers.",[65],{"id":66,"by":11,"text":67},"38637277","It's a library, one of the goals of which is compatibility with the many C89 compilers still in use today, so how else should I name it? And why is it bad or provoking to have a…",{"value":69,"source":54,"evidence":70},"Compatibility with many C89 compilers still in use.",[71],{"id":66,"by":11,"text":67},[73,79,85,89],{"value":74,"source":54,"evidence":75},"C89",[76],{"id":77,"by":11,"text":78},"38640234","\"Pure\" doesn't apply to \"language purity\" (nobody besides a very few seem to really care about the latter, especially not in C, not even compiler authors), but that nothing else…",{"value":80,"source":54,"evidence":81},"Pthreads",[82],{"id":83,"by":11,"text":84},"38640609","Well, both use channels, as did Occam, Joyce or Newsqueak even before. But my library uses kernel threads (Pthreads, Win32 threads), no coroutines, nor user mode scheduling. So…",{"value":86,"source":54,"evidence":87},"Win32 threads",[88],{"id":83,"by":11,"text":84},{"value":90,"source":54,"evidence":91},"qmake",[92],{"id":93,"by":11,"text":94},"38657731","Welcome; I don't use make; the pro is a qmake file; I likely will add a BUSY file, but until then you can just use e.g. \"cc -std=c89 *.c -lpthread\".","open_source","unknown",{"praise":98,"objections":114,"requests":140,"questions":159,"alternatives":174},[99,107],{"value":100,"source":101,"evidence":102},"Clean, easy-to-use design.","commenter",[103],{"id":104,"by":105,"text":106},"38633419","sim7c00","not being a god level programmer i wont go into quality of code, but this looks to me really neat and easy to use. well done!",{"value":108,"source":101,"evidence":109},"Useful for constrained or portable C targets.",[110],{"id":111,"by":112,"text":113},"38636566","solid_fuel","I love seeing projects like this, thanks for sharing. I've worked in constrained environments before where anything past C89 was trouble, it's a nice target for portability even…",[115,126,133],{"value":116,"source":101,"evidence":117},"Not truly pure C89; uses non-standard constructs and headers.",[118,122],{"id":119,"by":120,"text":121},"38635289","kazinator","1. There is no \u003Cmemory.h> in any version of ISO C, nor in POSIX. 2. This is not C89; at best GNU C 89, because a variable is declared after a statement: ``` { if( msgLen == 0 )…",{"id":123,"by":124,"text":125},"38633768","galkk","Even looking at simple code example, with casting from\u002Fto void, returning 0 as void etc, I cannot understand how people are calling C easy and productive language",{"value":127,"source":101,"evidence":128},"API lacks custom allocator, logging, and fd-based select integration.",[129],{"id":130,"by":131,"text":132},"38633438","eqvinox","It's 2023 - even MSVC has supported C11 and C17 for a while now. C89 is no longer a feature to advertise, it's an unhelpful constraint forcing poorer quality code. A good example…",{"value":134,"source":101,"evidence":135},"Closed-channel check is racy.",[136],{"id":137,"by":138,"text":139},"38633477","vore","while (!CspChan_closed(chan)) { ... } seems like a concurrency footgun – what's stopping the channel from being closed in between the check for it being closed and the operation…",[141,148,152],{"value":142,"source":101,"evidence":143},"Document edge cases such as sending to a closed channel.",[144],{"id":145,"by":146,"text":147},"38634802","openasocket","Very interesting! I program a lot in Go, and while I have my complaints about the language, I find the CSP model to be very easy to work with. I'd recommend adding some…",{"value":149,"source":101,"evidence":150},"Add benchmarks.",[151],{"id":145,"by":146,"text":147},{"value":153,"source":101,"evidence":154},"Provide a plain Makefile.",[155],{"id":156,"by":157,"text":158},"38656542","hollimolli","Thanks for this. It would actually be nice to have a plain old Makefile. The .pro file doesn't look like anything I know.",[160,167],{"value":161,"source":101,"evidence":162},"Are unbuffered channels slow due to scheduling thrashing?",[163],{"id":164,"by":165,"text":166},"38633746","samsquire","Wow, thank you for this. Good work! Some thoughts: I've often thought that unbuffered channels would cause scheduling thrashing - higher latency and lower throughput because…",{"value":168,"source":101,"evidence":169},"Are channels a good concurrency primitive for application code?",[170],{"id":171,"by":172,"text":173},"38634866","iainmerrick","Sorry for going a bit off-topic, but something I'm curious about: are channels thought to be a good\u002Fuseful tool for concurrent programming? My feeling is that they're probably…",[175,186,193],{"value":176,"source":101,"evidence":177},"libmill and libdill",[178,182],{"id":179,"by":180,"text":181},"38634275","Matthias247","libmill (https:\u002F\u002Fgithub.com\u002Fsustrik\u002Flibmill) and libdill (https:\u002F\u002Fgithub.com\u002Fsustrik\u002Flibdill) should be similar and probably mentioned. As far as I understand the differences…",{"id":183,"by":184,"text":185},"38633497","rockwotj","Related is libmill, which has been around for awhile and is was previously discussed on HN: https:\u002F\u002Fnews.ycombinator.com\u002Fitem?id=30699829 libmill supports a bunch of stuff like…",{"value":187,"source":101,"evidence":188},"ZeroMQ inproc sockets",[189],{"id":190,"by":191,"text":192},"38634169","Zambyte","This is really cool! I do want to say though, if you're considering using this for a production system: it's worth also considering ZeroMQ inproc sockets[0]. They allow for very…",{"value":194,"source":101,"evidence":195},"Plan 9 libthread",[196,200],{"id":197,"by":198,"text":199},"38633965","p_l","fun fact - Go Channels started out as pretty thin syntax sugar over features provided by Plan9's C libthread.",{"id":201,"by":202,"text":203},"38633521","pjmlp","Basically what ended up replacing Alef in Plan 9. https:\u002F\u002F9p.io\u002Fmagic\u002Fman2html\u002F2\u002Fthread",{"comments":205,"answered":39,"key":206},13,[207,208,209],{"id":77,"text":78},{"id":57,"text":58},{"id":210,"text":211},"38645689","Again: I now have changed the repository description to \"A pure C (-std=c89) implementation of Go channels, including blocking and non-blocking selects.\", so hopefully this…",{"commenters":213,"max_depth":214,"maker_replies":205,"first_comment_mins":215,"lifespan_hours":216},93,11,31,264,[218,220,222,225,226,228,230,232,235,238,240,244,245,248,250,253,255,257,261,265,267,270,272,275,277,278,279,280,284,286,290,293,295,297,301,303,305,308,310,312,315,318,321,323,326,329,331,335,338,341,344,347,350,352,355,358,360,362,364,366,368,370,372,374,376,378,381,383,386,389,392,395,398,401,403,405,407,409,412,414,416,418,421,423,425,428,430,433,435,438,440,442,445,447,450,453,456,459,462,465,467,469,472,475,478,480,482,485,488,490,492,495,497,499,502,505,507,508,511,513,515,518,521,523,526,529,532,536,539,541,544,546,548,552,555,558,561,563,565,567,570,572,575,578,581,584,587,590,594,597,599,601,603,605,608,609,613,614,618,619,622,624,626,628,630,633,635,637,638,642],[119,34,34,219,120,34],"commenter\u002Fcritical\u002Fexecution",[77,34,34,221,11,40],"maker\u002Fneutral\u002Fdocs",[223,34,34,224,120,34],"38644918","commenter\u002Fcritical\u002Fdocs",[57,34,34,221,11,40],[227,34,34,224,120,34],"38645432",[210,34,34,229,11,40],"maker\u002Fneutral\u002Fnone",[231,34,34,219,120,34],"38646448",[233,34,34,234,157,34],"38656018","commenter\u002Fcritical\u002Fnone",[236,34,34,237,120,34],"38658923","commenter\u002Fneutral\u002Fnone",[239,34,34,237,157,34],"38659997",[241,34,34,242,243,34],"38756303","other\u002Fneutral\u002Fnone","derefr",[60,34,34,221,11,40],[246,34,34,237,247,34],"38649463","chfalck",[249,34,34,229,11,40],"38649693",[251,34,48,252,247,34],"38660044","maker\u002Fpositive\u002Fidea",[254,34,34,229,11,40],"38660677",[164,40,48,256,165,34],"project\u002Fpositive\u002Fperformance",[258,40,39,259,260,34],"38638758","project\u002Fneutral\u002Fperformance","Galanwe",[262,40,34,263,264,34],"38639529","commenter\u002Fneutral\u002Fperformance","jpc0",[145,49,48,266,146,34],"project\u002Fpositive\u002Fdocs",[268,49,34,237,269,34],"38638763","xyproto",[179,39,39,271,180,34],"project\u002Fneutral\u002Fidea",[273,39,39,271,274,34],"38638675","samuell",[276,39,39,271,180,34],"38648914",[201,46,39,271,202,34],[83,46,34,271,11,40],[190,48,39,271,191,34],[281,48,40,282,283,34],"38637269","project\u002Fcritical\u002Fperformance","smabie",[137,18,40,285,138,34],"project\u002Fcritical\u002Fexecution",[287,18,40,288,289,34],"38634616","project\u002Fcritical\u002Fdocs","withinboredom",[291,18,40,285,292,34],"38636671","codys",[294,18,34,237,138,34],"38637987",[130,44,40,296,131,34],"project\u002Fcritical\u002Fdesign",[298,44,39,299,300,34],"38633481","project\u002Fneutral\u002Fdesign","coumbaya",[302,44,40,296,131,34],"38633553",[304,44,34,237,300,34],"38633954",[306,44,34,242,307,34],"38633504","dang",[309,44,34,237,131,34],"38633601",[311,44,34,237,307,34],"38633734",[313,44,34,234,314,34],"38635774","pwdisswordfishc",[316,44,34,242,317,34],"38636180","IAmLiterallyAB",[319,44,34,234,320,34],"38637887","da39a3ee",[322,44,34,242,307,34],"38638165",[324,44,34,242,325,34],"38639495","faiD9Eet",[327,44,48,328,264,34],"38639597","project\u002Fpositive\u002Fdesign",[330,44,34,242,131,34],"38639797",[332,44,48,333,334,34],"38642190","maker\u002Fpositive\u002Fnone","swingingFlyFish",[336,44,34,242,337,34],"38634065","drewg123",[339,44,34,242,340,34],"38634291","lnxg33k1",[342,44,34,242,343,34],"38659777","hn_throwaway_99",[345,44,34,242,346,34],"38637292","helsinki",[348,44,34,242,349,34],"38637336","defrost",[351,44,34,242,307,34],"38638172",[353,44,34,237,354,34],"38633528","oconnor663",[356,44,34,237,357,34],"38635077","wiseowise",[359,44,34,242,317,34],"38636140",[361,44,34,242,131,34],"38639494",[363,44,34,242,354,34],"38662621",[365,44,40,296,120,34],"38633552",[367,44,39,299,131,34],"38633893",[369,44,34,237,120,34],"38634413",[371,44,34,237,292,34],"38636578",[373,44,34,237,120,34],"38636775",[375,44,34,237,292,34],"38636913",[377,44,34,237,120,34],"38636984",[379,44,34,237,380,34],"38635598","Xeamek",[382,44,34,237,120,34],"38635785",[384,44,34,237,385,34],"38638069","__d",[387,44,34,242,388,34],"38634083","sylware",[390,44,34,242,391,34],"38634354","IlliOnato",[393,44,34,242,394,34],"38634661","zogrodea",[396,44,34,242,397,34],"38636986","8372049",[399,44,34,242,400,34],"38639021","kevindamm",[402,44,34,242,391,34],"38640978",[404,44,34,242,400,34],"38641677",[406,44,34,242,394,34],"38639842",[408,44,34,242,391,34],"38640535",[410,44,34,242,411,34],"38640785","lizmat",[413,44,34,242,391,34],"38640933",[415,44,34,242,397,34],"38641680",[417,44,34,242,391,34],"38640442",[419,44,34,242,420,34],"38635409","dgfitz",[422,44,34,242,388,34],"38640541",[424,44,34,242,391,34],"38640575",[426,44,34,242,427,34],"38636618","speed_spread",[429,44,34,242,391,34],"38640598",[431,44,34,237,432,34],"38638388","lelanthran",[434,44,34,237,388,34],"38639692",[436,44,34,237,437,34],"38648538","vacuity",[439,44,34,237,388,34],"38653100",[441,44,34,237,437,34],"38658522",[443,44,34,237,444,34],"38638526","cellularmitosis",[446,44,34,237,388,34],"38639695",[448,44,40,285,449,34],"38634141","MrRadar",[451,44,48,328,452,34],"38634230","tomcam",[454,44,34,237,455,34],"38635065","38",[457,44,40,285,458,34],"38635329","fweimer",[460,44,34,237,461,34],"38634351","pengaru",[463,44,48,333,464,34],"38634353","neverartful",[466,44,34,333,11,40],"38644719",[468,44,48,333,260,34],"38634882",[470,44,40,288,471,34],"38634923","dekhn",[473,44,39,299,474,34],"38635339","jansommer",[476,44,34,237,477,34],"38637242","arp242",[479,44,34,237,474,34],"38639422",[481,44,34,237,202,34],"38640664",[483,44,39,299,484,34],"38635600","Conscat",[486,44,34,242,487,34],"38636243","jamal-kumar",[489,44,34,242,349,34],"38636291",[491,44,34,242,484,34],"38637285",[493,44,34,242,494,34],"38638723","rurban",[496,44,34,242,477,34],"38637237",[498,44,34,242,11,40],"38635851",[500,44,39,229,501,34],"38636511","sevagh",[503,44,48,328,504,34],"38637264","anitil",[506,44,48,328,444,34],"38638096",[66,44,34,333,11,40],[509,44,39,510,131,34],"38639968","maker\u002Fneutral\u002Fdesign",[512,44,34,237,11,40],"38640352",[514,44,39,229,501,34],"38644347",[516,44,34,237,517,34],"38638053","justin66",[519,44,34,242,520,34],"38636580","kovac",[522,44,34,242,11,40],"38636632",[524,44,34,237,525,34],"38637095","RangerScience",[527,44,39,299,528,34],"38636241","jjgreen",[530,44,48,328,531,34],"38636408","accelbred",[533,44,48,534,535,34],"38636433","project\u002Fpositive\u002Fidea","Brian_K_White",[537,44,40,285,538,34],"38636773","kevin_thibedeau",[540,44,34,237,535,34],"38637212",[542,44,40,288,543,34],"38642913","epcoa",[545,44,34,237,444,34],"38638385",[547,44,40,296,385,34],"38638103",[549,44,39,550,551,34],"38638139","project\u002Fneutral\u002Fdocs","buildartefact",[553,44,34,237,554,34],"38639003","1vuio0pswjnm7",[171,556,34,557,172,34],8,"other\u002Fneutral\u002Fidea",[559,556,34,237,560,34],"38634944","JyB",[562,556,34,557,146,34],"38635532",[564,556,34,557,172,34],"38636258",[566,556,34,557,146,34],"38636802",[568,556,34,557,569,34],"38637602","jen20",[123,571,40,285,124,34],9,[573,571,34,242,574,34],"38633815","vngzs",[576,571,34,242,577,34],"38636063","trealira",[579,571,34,242,580,34],"38637651","kristianp",[582,571,34,242,583,34],"38637984","0xbadcafebee",[585,571,34,242,586,34],"38633989","salawat",[588,571,34,237,589,34],"38639419","chii",[591,571,39,592,593,34],"38634528","project\u002Fneutral\u002Fexecution","zeroCalories",[595,571,34,242,596,34],"38634654","SAI_Peregrinus",[598,571,34,242,589,34],"38639402",[600,571,34,242,202,34],"38640673",[602,571,40,285,292,34],"38637558",[183,604,34,557,184,34],10,[606,604,34,242,607,34],"38638185","adastra22",[111,214,48,328,112,34],[610,611,39,271,612,34],"38633708",12,"mmcgaha",[197,205,34,242,198,34],[615,616,34,557,617,34],"38634674",14,"segmondy",[104,32,48,328,105,34],[620,35,39,259,621,34],"38633654","bufo",[623,35,39,259,131,34],"38633743",[625,35,39,259,621,34],"38634635",[627,35,39,259,607,34],"38638216",[629,35,39,259,621,34],"38653578",[631,35,34,242,632,34],"38641046","another2another",[634,35,34,242,621,34],"38653567",[156,636,39,550,157,34],17,[93,636,34,221,11,40],[639,640,48,534,641,34],"38635515",18,"flkenosad",[643,644,40,645,646,34],"38635575",19,"project\u002Fcritical\u002Fidea","asylteltine",[],[649,654,658,663,668,673],{"id":650,"name":651,"points":652,"category":653},"38596953","Sagittarius",434,"ai",{"id":655,"name":656,"points":657,"category":653},"38611700","macOSpilot",430,{"id":659,"name":660,"points":661,"category":662},"38635695","Agora",317,"web_saas",{"id":664,"name":665,"points":666,"category":667},"38612680","Advent of Distributed Systems",263,"learning_science",{"id":669,"name":670,"points":671,"category":672},"38577240","OSS Software",245,"other",{"id":674,"name":675,"points":676,"category":653},"38587052","SecureAI Tools",234,false,"v2",{"id":680,"name":5,"line":6,"ai":677,"cat":20,"year":13,"points":14,"comments":15,"rec":29,"s":681,"top":18,"kw":682,"maker":11,"domain":10,"tier":19,"attempts":34,"strip":683,"url":9,"mix":684,"praise":100,"objection":116,"sub":21},38632970,0.03,[24,25,26,27,28],"0005531110550130000000243335351101315433",[32,33,34,35],1794036646107]