Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Post
  • Reply
Notorious b.s.d.
Jan 25, 2003

by Reene

Symbolic Butt posted:

oh man I never really checked this book specifically but I know Norvig is awesome

it's a deeply frustrating piece of work and also pretty fuckin cool

i guess that's the sign of a "fun" textbook?

then again you are almost certainly smarter and better-educated than i am, or was fifteen years ago, so you may find it easier going.

Adbot
ADBOT LOVES YOU

Xarn
Jun 26, 2015

jit bull transpile posted:

yeah, it's just every demonstration I've seen of it could be done just as easily by writing all your facts and constraints in a notebook and then staring at them for 5 minutes.

I guess it's just one of those really narrowly applicable tools.

quote:

Every demonstration of sorting I've seen could be done just as easily by writing the numbers down in the right order right away

:shrug:

echinopsis
Apr 13, 2004

by Fluffdaddy
this is not the thread to battle one another

Cybernetic Vermin
Apr 18, 2005

at least one key use-case for prolog is when you have a large (but small enough to fit in memory) lump of data that looks mostly relational but would be a huge pain to properly fit into a database and an even bigger pain to query. then prolog often turns out to be the really nice way to structure and walk about in it, without having to explicitly do the walking

that is at least the only (despite further attempts) times i have managed to make good use of prolog, exploratively making sense of a mix of interrelated like xml and logs and little database fragments, and having the exploration be an actual useful program at the end

Cybernetic Vermin fucked around with this message at 10:56 on Feb 25, 2019

cinci zoo sniper
Mar 15, 2013




bob dobbs is dead posted:

sf bay goon meet sgtm

you get to see my distressingly young-lookin fat face

hello there, i still get carded for energy drinks

Captain Foo
May 11, 2004

we vibin'
we slidin'
we breathin'
we dyin'

echinopsis posted:

this is not the thread to battle one another

wrong, binch

fart simpson
Jul 2, 2005

DEATH TO AMERICA
:xickos:

cinci zoo sniper posted:

hello there, i still get carded for energy drinks

?

Suspicious Dish
Sep 24, 2011

2020 is the year of linux on the desktop, bro
Fun Shoe
Pinging slurps mad rips or hackbunny or jmccall. Did they actually fix modules before ship?

https://twitter.com/jfbastien/status/1099420319847145473?s=21

carry on then
Jul 10, 2010

by VideoGames

(and can't post for 10 years!)

echinopsis posted:

this is not the thread to battle one another

nerds will never actually like each other, their egos prevent it

cinci zoo sniper
Mar 15, 2013





it is what it says on the tin, my face is also fat and young-looking. energy drinks are from 16 or 18 here, I don’t even know, and there isn’t a month when I don’t have to show my ID to prove to someone that I’m old enough

fart simpson
Jul 2, 2005

DEATH TO AMERICA
:xickos:

you need id to buy caffeine?

Cybernetic Vermin
Apr 18, 2005

i'm pretty sure a quick google would have told you that, yes, this is indeed the case in some parts of the world.

rjmccall
Sep 7, 2007

no worries friend
Fun Shoe
c++20 modules are still pretty much microsoft modules instead of clang modules, i think. that is, they’re a code-organization tool for people willing to radically rework their source code. we just made sure that they weren’t wildly incompatible with clang modules, which of course we’ll keep doing whether they’re standard or not

Zlodo
Nov 25, 2006

Suspicious Dish posted:

Pinging slurps mad rips or hackbunny or jmccall. Did they actually fix modules before ship?

https://twitter.com/jfbastien/status/1099420319847145473?s=21

oh cool, I use coroutines to make generators in my idiot spare time project, great to see I won't have to depend on an experimental feature forever

CPColin
Sep 9, 2003

Big ol' smile.

carry on then posted:

nerds will never actually like each other, their egos prevent it

You shouldn't assume none of us like each other, just because nobody likes you.

Private Speech
Mar 30, 2011

I HAVE EVEN MORE WORTHLESS BEANIE BABIES IN MY COLLECTION THAN I HAVE WORTHLESS POSTS IN THE BEANIE BABY THREAD YET I STILL HAVE THE TEMERITY TO CRITICIZE OTHERS' COLLECTIONS

IF YOU SEE ME TALKING ABOUT BEANIE BABIES, PLEASE TELL ME TO

EAT. SHIT.


rjmccall posted:

c++20 modules are still pretty much microsoft modules instead of clang modules, i think. that is, they’re a code-organization tool for people willing to radically rework their source code. we just made sure that they weren’t wildly incompatible with clang modules, which of course we’ll keep doing whether they’re standard or not

is there a good writeup for modules because the first google result is some painfully obvious javascript developer getting excited about NPM for C++

Slurps Mad Rips
Jan 25, 2009

Bwaltow!

Suspicious Dish posted:

Pinging slurps mad rips or hackbunny or jmccall. Did they actually fix modules before ship?

https://twitter.com/jfbastien/status/1099420319847145473?s=21

im not too worried.

we got merged modules which toned down the Microsoft modules stuff. a few additions regarding linkage and inline definition storage are sneaking around waiting for a few defect reports and national body comments that need to be resolved but you can blame clang developers for that one :v:. The SG15 tooling group is working on a TR (not a TS) to define some module modes for upgrade paths for vendors. we had Microsoft and clang people in the room, GCC people decided it wasn’t worth it being there, lol.

any issues left with modules can effectively be solved with tooling (minus the “your compiled interface stores the definition of your online functions in the BMI” issue mentioned above)

one interesting thing I learned from clang developers however is that they plan to make it that every time you add any flag to your command line, you need to basically rebuild the world. added -Wall? gently caress you rebuild everything. the hand waving we got from two clang devs that this is totally fine was ridiculous. warning flags don’t affect code generation so this is just dumb.

as for code organization, the only thing we have regarding that are module partitions. Those seem to have come from a few non google/non ms people

honestly people seemed more upset about contracts than modules. :v:

Suspicious Dish
Sep 24, 2011

2020 is the year of linux on the desktop, bro
Fun Shoe
The reason I ask is because you wrote a very impassioned blog post about his modules wouldn't solve any of the problems that people thought they would. I assume some of those concerns no longer apply to the new proposal?

fart simpson
Jul 2, 2005

DEATH TO AMERICA
:xickos:

Cybernetic Vermin posted:

i'm pretty sure a quick google would have told you that, yes, this is indeed the case in some parts of the world.

uhh screw that

gonadic io
Feb 16, 2011

>>=

fart simpson posted:

uhh screw that

In the UK its not law, but all major supermarkets restrict energy drinks (red bull et al) from 16 and under

aardvaard
Mar 4, 2013

you belong in the bog of eternal stench

fart simpson posted:

uhh screw that

some kids with heart conditions died from chugging a ton of energy drinks so now parents think they're the new smoking

DONT THREAD ON ME
Oct 1, 2002

by Nyc_Tattoo
Floss Finder
uggghh https://rustjobs.rs/

quote:

There are no open rust jobs anywhere in the world.

That doesn't sounds right... post a job.

gonadic io
Feb 16, 2011

>>=

Lol, guess that's what it looks like when you're ethical and don't scrape!

I have a Google jobs search for "rust -blockchain" in London and get a new one every day or two. Got a final interview at a large company on Monday for a python project being rewritten in rust.

DONT THREAD ON ME
Oct 1, 2002

by Nyc_Tattoo
Floss Finder

gonadic io posted:

Lol, guess that's what it looks like when you're ethical and don't scrape!

I have a Google jobs search for "rust -blockchain" in London and get a new one every day or two. Got a final interview at a large company on Monday for a python project being rewritten in rust.

Nice, I'll give that a shot.

JawnV6
Jul 4, 2004

So hot ...

gonadic io posted:

Rust isn't only about the lifetimes, it does have a HM functionalish type system with standard enums, adts, pattern matching, first class functions, generics, type classes etc etc
what is HM in this context and how does it describe, say, awareness of bus widths? i literally don't understand how 'generics' helps me with 'this register is w1c in some bits' but it doesn't sound like we're talking about the same thing

BobHoward posted:

i get the impression they don't quite understand how typical it is to pack a bunch of non byte sized, non byte aligned fields in a single hw register, where the register access path often does not even support byte-at-a-time access semantics, much less bit-at-a-time (which the cpu doesn't support anyways)

i do this kind of layout when designing registers all the time. i also often end up writing the software that manipulates them. it's fine. i don't want to chew up enormous amounts of address space and bloat out the read muxes to give every 1 bit field its own 32 bit word. fite me haters
there's a really fun naive solution to this where every bit gets its own 32- (or 64-)bit reg

then we only notice the problem way down the line when we've blown out our page tables trying to address them all

but again, that would require awareness of the virtual memory system and/or working without a giant OS cleaning up after you

BobHoward posted:

also like someone mentioned above, if you're in any place where there's minimal competence you have some kind of simple source code - csv file, json, custom minilang, whatever - that the hardware engineers write to describe registers, and there's scripts to 'compile' that source to C headers and Verilog source code for use on both sides of the hardware/software divide. maybe documentation files too, or documentation embedded in the C headers

the output of these 'compilers' looks ugly to humans when you dig underneath the surface API, but it's a problem no HLL i'm aware of has ever attempted to address in a clean way, so you sweep all the ugliness into machine generated code and it's all fine
i've worked with a half dozen or so of these, ranging from "okay i guess" to "christ don't touch it or look at it funny," and anything that tries to make assumptions outside the ball o' tools is going to get caught in the crossfire

this is all real hardware behavior i've worked with:
w1c - write of 1 clears the bit
raz - always reads as 0, writing 1 or 0 can have different effects
fifo - aware of width of read, pops that many entries off fifo

like there are times i really want to control several fine-grained aspects of an 8- or 32-bit access somewhere, and functional folks yelling down that a type system can cover all of these and other HW vagaries doesn't impress me that they're aware of the problem space. does your type system think an extra read is harmless? does it understand what bits would need to be read out of HW before changing the field I'm interested in?

gonadic io
Feb 16, 2011

>>=

JawnV6 posted:

what is HM in this context and how does it describe, say, awareness of bus widths? i literally don't understand how 'generics' helps me with 'this register is w1c in some bits' but it doesn't sound like we're talking about the same thing

by hm I meant hindley-milner, i.e. a decent type system with generics, type classes, and good type inference.

i'm not entirely sure what i meant, maybe i had misunderstood your point but i think i was trying to say that rust is good and worth using even if you're not particular about exact bit widths etc

JawnV6
Jul 4, 2004

So hot ...
can i say 'write a 1 into this bit, poll until it reads back as 1' or am i still trudging through exacting semantics on what bus traffic i want

krakeenstyle was insistent that a good enough type system obviates this kind of drudgery, can it handle this table stakes use case?

DONT THREAD ON ME
Oct 1, 2002

by Nyc_Tattoo
Floss Finder
i really have no idea whether or not rust is suitable for the lowest of low level programming. it may never be. however, there are many things written in c++ today that could instead be written in rust and they'd be much better and safer.

it is a very nice to use unmanaged language. it is significantly nicer to use than c++. it is suitable for many of the use cases of c++, but i'm not sure that it's suitable for all of them. it's a high level systems programming language and that's fine and good. i think where rust evangelists fail is when they insist that it's ready to replace c++ when it really isnt.

honestly rust is what we should be using instead of go for all the docker/kuberentes stuff.

DONT THREAD ON ME fucked around with this message at 21:36 on Feb 25, 2019

pseudorandom name
May 6, 2007

JawnV6 posted:

can i say 'write a 1 into this bit, poll until it reads back as 1' or am i still trudging through exacting semantics on what bus traffic i want

krakeenstyle was insistent that a good enough type system obviates this kind of drudgery, can it handle this table stakes use case?

yes, but you do it in an unsafe block

Carthag Tuek
Oct 15, 2005

Tider skal komme,
tider skal henrulle,
slægt skal følge slægters gang



I was just shitposting but y'all are posting great stuff

DONT THREAD ON ME
Oct 1, 2002

by Nyc_Tattoo
Floss Finder
every programming language is type safe if you program on a kinesis advantage

Lutha Mahtin
Oct 10, 2010

Your brokebrain sin is absolved...go and shitpost no more!

DONT THREAD ON ME posted:

i think where rust evangelists fail is when they insist that it's ready to replace c++ when it really isnt.

but that one guy already wrote a little hobby OS in rust! we're clearly headed for the moooooon :q:

gonadic io
Feb 16, 2011

>>=

JawnV6 posted:

can i say 'write a 1 into this bit, poll until it reads back as 1' or am i still trudging through exacting semantics on what bus traffic i want

krakeenstyle was insistent that a good enough type system obviates this kind of drudgery, can it handle this table stakes use case?

a few ways:
1: dumbass c way:
code:
const FLAG_I_CARE_ABOUT: u8 = 2;
const MEM_ADDRESS: *mut u32 = 0xaabbcc as *mut u32;

unsafe {
    asm!("cli");
    let prev = ptr::read_volatile(MEM_ADDRESS);
    ptr::write_volatile(MEM_ADDRESS, prev || 1 << FLAG_I_CARE_ABOUT);
    asm!("sti");
    while (ptr::read_volatile(MEM_ADDRESS) && (1 << FLAG_I_CARE_ABOUT)) != 0 {
        asm!("nop")
    }
}
2: nicer, macro way. note that this is still better than the macro S_008BF0_ENABLE_PA_SC_OUT_OF_ORDER(x) approach because it's actual functions that exist in the type system and docs (which is possible to do in C but nobody ever does)
code:
use bitfield::bitfield;
const MY_PERIPH: *mut MyRegister = 0x01 as *mut MyRegister;

bitfield!{
  pub struct MyRegister(u8);
  flag, set_flag: 3;
}
unsafe {
    let my_perif = &mut *MY_PERIPH;
}
my_perif.set_flag(true);
while !my_perif.flag() { asm!("nop") }
3: nicest way: use a tool like svd2rust to generate a device crate with methods for all the registers and all the fields in each register and then that looks like:
code:
use atsamd21g18a::SERCOM0;
let my_perif = unsafe { (&mut *SERCOM0::ptr()).usart };
my_perif.intenset.write(|w| w.txc.set_bit())
while  !my_perif.intenset.read().txc.bit() { asm::nop() }
in the course of my messing around in rust on my cortex_m0 arduino i've done all three of these approaches

gonadic io fucked around with this message at 23:01 on Feb 25, 2019

gonadic io
Feb 16, 2011

>>=
4: instead of targeting a generic device, target a specific one with the e.g. cortex_m0 or even more specifically arduino_mkrzero crate and then you can access peripherals without unsafe code at all since
1) the addresses are known to be correct, and
2) there is a singleton flag system to ensure that your mutable references are actually unique like you promise they are (since it's UB to have multiple mutable references to the same memory location. multiple mut pointers are fine)

disclaimer: i am the author (and i suspect sole user) of the arduino_mkrzero crate

gonadic io fucked around with this message at 23:08 on Feb 25, 2019

pseudorandom name
May 6, 2007

or, 2.5: something like tock_registers

gonadic io
Feb 16, 2011

>>=
although having said all that too, i guess rust has actually had untagged unions for ages: this did work on stable so who knows what any more

code:
union MyUnion {
    reg: u32,
    fields: [u8; 4],
}

fn main() {
    let foo = MyUnion { reg: 1 };

    unsafe {
        println!("{}", foo.reg); // 1
        println!("{:?}", foo.fields); // [1, 0, 0, 0]
    }
}
I tried [bool; u32] and that did not work lol, std::mem::size_of::<[bool; 32]>() gives 32 bytes (thanks llvm)

Sagacity
May 2, 2003
Hopefully my epitaph will be funnier than my custom title.

Lutha Mahtin posted:

but that one guy already wrote a little hobby OS in rust! we're clearly headed for the moooooon :q:
it probably won't be big and professional like gnu

Blinkz0rz
May 27, 2001

MY CONTEMPT FOR MY OWN EMPLOYEES IS ONLY MATCHED BY MY LOVE FOR TOM BRADY'S SWEATY MAGA BALLS

DONT THREAD ON ME posted:

honestly rust is what we should be using instead of go for all the docker/kuberentes stuff.

does rust have a usable http server yet?

JawnV6
Jul 4, 2004

So hot ...
none of those looks like less code or maintenance than the equivalent C. #1 adds a read that I didn't specify and fucks around with interrupts in bare asm (????), #2 curiously drops these requirements, #3 is about the closest

none of it shows me the type system aware of the wonky register behavior and you're still janitoring each individual access to meet the HW spec

where's the magic

i didn't even mention memory that might go away from time to time

gonadic io posted:

2: nicer, macro way. note that this is still better than the macro S_008BF0_ENABLE_PA_SC_OUT_OF_ORDER(x) approach because it's actual functions that exist in the type system and docs (which is possible to do in C but nobody ever does)
"nobody ever does"? just said I've worked with a half dozen implementations of this idea, bob dobbs alluded to others. just because you're working with arduino-grade tools doesn't speak to the entirety of embedded work

sure makes the objections come into focus

Adbot
ADBOT LOVES YOU

DONT THREAD ON ME
Oct 1, 2002

by Nyc_Tattoo
Floss Finder

Blinkz0rz posted:

does rust have a usable http server yet?

it's perfectly usable, i've built lots of http servers in it, but i dont think we'll see production grade stuff until after async/await is stabilized. which is soon. obviously this is a requirement to build a kubernetes like system.

like it's real obvious go is not the right language for kuberenetes. stuff like not having a pluggable scheduler or at least be able to prioritize goroutines, a GC that isn't ideal for everything, running into real problems with the type system in large projects, etc.

rust fits in really well here, or at least it will once async is in. i wouldn't necessarily want to use it for web, not without a really user friendly framework, but i think it's perfect for building high performance servers.

DONT THREAD ON ME fucked around with this message at 00:31 on Feb 26, 2019

  • 1
  • 2
  • 3
  • 4
  • 5
  • Post
  • Reply