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
Bloody
Mar 3, 2013

taqueso posted:

I should be able to link verilog or vhdl with my normal code

cursed

Adbot
ADBOT LOVES YOU

DrPossum
May 15, 2004

i am not a surgeon

DELETE CASCADE posted:

there is no good reason to use dynamic typing. none. i will die on this hill

yeah but you've already started programming so reason has been cast to the wind

Carthag Tuek
Oct 15, 2005

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



brap posted:

if you write a prototype for demo purposes, and then you demo the prototype to management, you will end up shipping that prototype, so i don’t think you should write things as if you will get the luxury of throwing them away.

one word: load-bearing dongles

eschaton
Mar 7, 2007

Don't you just hate when you wind up in a store with people who are in a socioeconomic class that is pretty obviously about two levels lower than your own?

FamDav posted:

i want to meet the person who tried to emulate pipes in soa

queues

eschaton
Mar 7, 2007

Don't you just hate when you wind up in a store with people who are in a socioeconomic class that is pretty obviously about two levels lower than your own?

taqueso posted:

I should be able to link generate verilog or vhdl with my normal code

VikingofRock
Aug 24, 2008




IMO Python is mostly fine, but boy are its warts warty. I recently ran into one of my "favorite" python quirks in the wild, while helping my new-to-programming friend debug this line:

Python code:

if response in valid_responses == False:
  # prompt for a new response

The issue was that this code would accept any response and never prompt for a new response. Now, you might think it's a precedence issue, and find out that adding parens fixes it (or just change it to if response not in valid_reponses), and move on with your life. But you'd be missing out on the truth: this is actually parsed as

Python code:

if (response in valid_responses) and (valid_responses == False):
  # prompt for a new response

because Python expects "in" (and "is") to work like the usual comparison operators and wants to support if 2 < x < 5.

This is also why

Python code:

False is False is False

is True, but

Python code:

(False is False) is False

and

Python code:

False is (False is False)

are both False.

xtal
Jan 9, 2011

by Fluffdaddy
Until recently a date time object in Python would be true except at midnight, meaning you couldn't do 'if time:' but had to do 'if time is not None:'

I have a lot of experience teaching code to children and young adults, and people always choose Python for this, when Python is actually a terrible choice. Users don't understand how strict whitespace sensitivity is. Your example reminded me of this because they constantly write things like 'if n == 3 or 5:' which should be forbidden by a type checker.

Instead we had to start every class with a list of gotchas.

And making sure that everyone downloaded the right Python version. Most of them don't know the difference so if you don't go check each computer manually there will be at least one person who follows along in Python 2, failing everything, and not speaking up until the end.

xtal fucked around with this message at 04:35 on Jul 12, 2020

gonadic io
Feb 16, 2011

>>=
I had a surprising number of nonprogrammers start their numbers with leading zeroes when I was teaching python

Lutha Mahtin
Oct 10, 2010

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

i learned about octal when i had built the lookup table for a state machine in excel and was going to copy it over to my source code as a big ole array. i thought it would look prettier in the source file if the array numbers were all lined up, so that's an east fix, before we export it we'll just have excel insert leading zeroes in front of all the state numbers that are less than three characters long! :pseudo:

raminasi
Jan 25, 2005

a last drink with no ice

Phobeste posted:

i actually unironically looked up that article and recommended it to a coworker who was stuck in design paralysis and it worked great. thanks tef

every month the developer at my company who committed the most net line deletions to the main repo gets a slack shoutout and a goofy lil' toy prize

i'm the guy who runs it and at the end of last year i wrote a big ol email summarizing the year's code deletion accomplishments and then basically just paraphrased that article (with citation) to justify the endeavor

CarForumPoster
Jun 26, 2013

⚡POWER⚡

raminasi posted:

every month the developer at my company who committed the most net line deletions to the main repo gets a slack shoutout and a goofy lil' toy prize

i'm the guy who runs it and at the end of last year i wrote a big ol email summarizing the year's code deletion accomplishments and then basically just paraphrased that article (with citation) to justify the endeavor

Will you link the article?

Phobeste
Apr 9, 2006

never, like, count out Touchdown Tom, man

CarForumPoster posted:

Will you link the article?

https://programmingisterrible.com/post/139222674273/write-code-that-is-easy-to-delete-not-easy-to

quote:

If we see ‘lines of code’ as ‘lines spent’, then when we delete lines of code, we are lowering the cost of maintenance. Instead of building re-usable software, we should try to build disposable software.

I don’t need to tell you that deleting code is more fun than writing it.

To write code that’s easy to delete: repeat yourself to avoid creating dependencies, but don’t repeat yourself to manage them. Layer your code too: build simple-to-use APIs out of simpler-to-implement but clumsy-to-use parts. Split your code: isolate the hard-to-write and the likely-to-change parts from the rest of the code, and each other. Don’t hard code every choice, and maybe allow changing a few at runtime. Don’t try to do all of these things at the same time, and maybe don’t write so much code in the first place.

galenanorth
May 19, 2016

One thing with that Meowseum adoption website project I had a few years back is that the graphic designer who had worked for Nokia was all like "you'll get venture capital" a few years back, and I believed him because of the Juicero story and all that. I should've realized earlier that I wasn't getting venture capital for a business without so much as a business license or the ability to sell anything, just a page on some venture capital social media site with five hits. Instead, I should've geared it toward paying for listings and adoption posters, the same revenue model as https://www.tabbytracker.com or https://www.petharbor.com but better at it.

I also should've concentrated on having the minimal UI to get my first sale. I let myself get sidetracked with unnecessary tasks like allowing video uploads, which opened up a huge can of worms in terms of validation and processing. Also, I wanted to practice using JavaScript settings so I tried adding a night mode, and I found out the hard way that it's a bad idea to use JavaScript for page load effects because there was some flashing I could never get rid of.

Whenever I get back to the project, just for the sake of practicing, I'm probably going to start over from scratch. I'll be jettisoning the adoption side of the website to concentrate on the lost/found sections and removing the Organization type of user. I don't think I'm going to get any local shelters or animal rescue organizations to join an experimental website, and I didn't get any replies when I sent out emails last time. If charging for lost/found listings and posters is successful, I can try again later. When I first started, I thought I always had to use Bootstrap grids as long as I'm using Bootstrap. I kept having to tweak individual elements to position them closer to my mockup for optimal spacing between UI elements. By the time I was done, I realized that as long as I'm working from a mockup, using custom exact maximum column widths works a lot better.

I'm going to switch from using Django templates to using React. I wrote the project before ECMAScript 2015, so I'll probably update the JavaScript code to that version for the sake of practicing it. At that point, I also hadn't learned how to do virtualization with Python's venv module, and I was coding on Windows, so a lot of the modules are in this "C:\Program Files (x86)\Python35-32\Lib\site-packages" directory with some packages I altered under "C:\Program Files (x86)\Python35-32\Lib\site-packages_editable", because I was being lazy about collaborating on GitHub when I found bugs in a dependency.

Starting over from scratch and copying and pasting in code from the old project as I go will probably be easier. Aside from the practice, at least it'll be in better shape for answering the "Have a project? We'd like to see it" line in job listings.

galenanorth fucked around with this message at 03:47 on Jul 13, 2020

bob dobbs is dead
Oct 8, 2017

I love peeps
Nap Ghost
how about you stop givin one poo poo about code and start being obsessed with how nobody wants this poo poo

abstract words like validation and product market fit distract from the essential problem of nobody wanting your poo poo and lure people towards assuming people want their poo poo

after literally becoming the largest company in the world by market cap amazon still has regular and astounding episodes of nobody wanting their poo poo (their video game, the treasure trucks, the phone etc etc). you will never stop being paranoid that people dont want your poo poo

also dont send out emails, pick up the phone or show up. bad timing for showing up

bob dobbs is dead
Oct 8, 2017

I love peeps
Nap Ghost
at the same time as nobody wanting your poo poo everybody will lie to your face about wanting your poo poo because their actual task at hand is to try to get the dipshit out of their face right now

welcome to startupland! it helps to be asking questions

Ciaphas
Nov 20, 2005

> BEWARE, COWARD :ovr:


can someone explain like i'm five years old rust arrays, slices, references and lifetimes and why the hell i can't make this code fragment work no matter what i try putting in place of the pointed-to parens
code:
pub struct CANPacket {
    _id: u32,
    _data: [u8;8] // or do i want &[u8] or &'a[u8] or some loving thing? i just want a ref to the 8 bytes this struct was constructed with! gently caress!!!	
}
impl CANPacket {
    pub fn id(&self) -> u32 { self._id }
    pub fn data(&self) -> &[u8] { &self._data }
    pub fn new(id: u32, data: &[u8]) -> Self {
        let x = Self {
            _id: id,
            _data: () <-------
        };
        return x;
    }
[...]
}

CarForumPoster
Jun 26, 2013

⚡POWER⚡

bob dobbs is dead posted:

how about you stop givin one poo poo about code and start being obsessed with how nobody wants this poo poo


this

make something people want and will tell their friends about

RPATDO_LAMD
Mar 22, 2013

🐘🪠🍆

Ciaphas posted:

can someone explain like i'm five years old rust arrays, slices, references and lifetimes and why the hell i can't make this code fragment work no matter what i try putting in place of the pointed-to parens
code:
pub struct CANPacket {
    _id: u32,
    _data: [u8;8] // or do i want &[u8] or &'a[u8] or some loving thing? i just want a ref to the 8 bytes this struct was constructed with! gently caress!!!	
}
impl CANPacket {
    pub fn id(&self) -> u32 { self._id }
    pub fn data(&self) -> &[u8] { &self._data }
    pub fn new(id: u32, data: &[u8]) -> Self {
        let x = Self {
            _id: id,
            _data: () <-------
        };
        return x;
    }
[...]
}
there are three relevant types here.
  • [u8;8] is a statically-allocated array of exactly 8 bytes. if you create your struct with that, you'll have a copy of the original bytes.
  • &[u8;8] is a reference to an array of exactly length 8. it is guaranteed to always have 8 real values inside it.
  • &[u8] is a reference to a slice of a u8 array. It may have any arbitrary length, including 0. notably, it can have a length less than 8, so it can't be safely converted into a [u8;8] -- it could fail at runtime if the slice was too short. basically, slices work the same way passing a pointer and a length works in C, including that you might get the wrong length for what you want.

you can always take a reference to a [u8;8] to create a &[u8;8], or a slice of part or all of it to create a &[u8], but you can't safely go backwards, at least not at compile time -- the length information is no longer part of the type

since your new function just takes a slice as its argument, there is no guarantee that it will actually have 8 bytes to read. if you really want to keep the signature this way for some reason, you can do something like this:
code:
use std::convert::TryInto;
[...]
    pub fn new(id: u32, data: &[u8]) -> Self {
        let x = Self {
            _id: id,
            _data: data.try_into().expect("Data was less than 8 bytes long!"),
        };
        return x;
    }
if you pass a slice of the wrong length into the function, this will panic at runtime (with the message "Data was less than 8 bytes long!").
for real code you could handle it in some other way -- try_into() returns a Result, so instead of calling expect() or unwrap() you can just match on the return value and do whatever you want if it's an error.

the cleaner option is to make your new function accept an array reference with an explicit length:
code:
    pub fn new(id: u32, data: &[u8; 8]) -> Self {
        let x = Self {
            _id: id,
            _data: *data,
        };
        return x;
    }
this will never panic at runtime, because it enforces at compile time that you're actually passing in an 8-length array and not just any old reference to any arbitrary-length slice.

also notable: in rust, the last statement of any block is always returned (as long as it has no semicolon), so you don't need the "let x = ... return x" bits.
code:
    pub fn new(id: u32, data: &[u8; 8]) -> Self {
         Self {
            _id: id,
            _data: *data,
        }
    }
now if you actually wanted your struct to store a reference and not a copy of the data (say, it's 800 bytes long instead of just 8 so it's no longer cheap to copy), you have to care about lifetimes
a lifetime is a template parameter to a type or a function that tells it how long it's allowed to live without ending up with a potential dangling pointer

code:
struct CANPacket2<'a> {
    _id: u32,
    _data: &'a [u8; 800]
}
if we change the struct this way, it will store just a reference to the memory location of the data array somewhere else. this also means that the struct as a whole has its lifetime tied to the lifetime of that reference, so if you construct it from a function-local array or something, you won't be able to return the struct outside that function, or the compiler will complain

lifetimes are used as template parameters, just like types are, so we want to specify explicitly that we're varying on it when we write the implementation
code:
impl<'a> CANPacket2<'a> {
now that we've done that, the lifetime variable 'a is defined, and we can use it in our function signatures
here, we specify that the new function takes a data argument whose lifetime is ALSO 'a.
code:
    pub fn new(id: u32, data: &'a [u8; 800]) -> Self {
        Self {
            _id: id,
            _data: data,
        }
    }
}
this is inside that impl block above, so the Self it's returning isn't CANPacket2, it's CANPacket2<'a> -- if you pass a data array whose lifetime is "until the end of this if block" into the function, you'll get out a CANPacket2<'untilendofthisblock>

fart simpson
Jul 2, 2005

DEATH TO AMERICA
:xickos:

Ciaphas posted:

can someone explain like i'm five years old rust arrays, slices, references and lifetimes and why the hell i can't make this code fragment work no matter what i try putting in place of the pointed-to parens
code:
pub struct CANPacket {
    _id: u32,
    _data: [u8;8] // or do i want &[u8] or &'a[u8] or some loving thing? i just want a ref to the 8 bytes this struct was constructed with! gently caress!!!	
}
impl CANPacket {
    pub fn id(&self) -> u32 { self._id }
    pub fn data(&self) -> &[u8] { &self._data }
    pub fn new(id: u32, data: &[u8]) -> Self {
        let x = Self {
            _id: id,
            _data: () <-------
        };
        return x;
    }
[...]
}

your types dont match up.

your struct has a [u8;8] and your new function takes a &[u8].
1. your probably either gonna want to use try_into in the new function to make it into a [u8;8] also, or have new take a [u8;8] as its input argument.
2. you also need to figure out who owns the data here. you might want to be copying the data in your constructor, or if you use references for everything your gonna need to put explicit lifetimes on your struct, in your impl block, and on the data argument in the constructor

fart simpson
Jul 2, 2005

DEATH TO AMERICA
:xickos:

yeah what that guy said

gonadic io
Feb 16, 2011

>>=

fart simpson posted:

2. you also need to figure out who owns the data here. you might want to be copying the data in your constructor, or if you use references for everything your gonna need to put explicit lifetimes on your struct, in your impl block, and on the data argument in the constructor


yeah this is the fundamental problem here (assuming you don't just copy the bytes as [u8; 8] as mentioned). trying to store a reference inside a struct is precisely the thing rust is paranoid about because what if you drop the original memory but still have the struct with the reference in??? what if you accidentally try to reference it?

with the CANPacket<'a>(&'a [u8; 8]) construction you will also run into issues if you try to drop the original memory before you drop the struct - there's no going off and storing this struct somewhere else unless you keep the original buffer alive for the whole of the rest of your program.

i.e. this part:

RPATDO_LAMD posted:

if we change the struct this way, it will store just a reference to the memory location of the data array somewhere else. this also means that the struct as a whole has its lifetime tied to the lifetime of that reference, so if you construct it from a function-local array or something, you won't be able to return the struct outside that function, or the compiler will complain

gonadic io
Feb 16, 2011

>>=
but yeah it's just 8 bytes loving copy it and not give a gently caress. until you're doing zeRo cOpY and need every nanosecond from your code I tend to avoid using references all over the place just because it requires you to think harder. note that you have to think exactly the same about if you were doing this in C++ if you don't want memory safety bugs but the compiler won't complain at you when you don't

fart simpson
Jul 2, 2005

DEATH TO AMERICA
:xickos:

Ciaphas posted:

can someone explain like i'm five years old rust arrays, slices, references and lifetimes and why the hell i can't make this code fragment work no matter what i try putting in place of the pointed-to parens

i think you probably dont really need an explanation on arrays and slices. arrays are just statically sized arrays. slices are basically arrays where the size is known at runtime rather than compile time. not really anything different here than other languages. e-z.

references and lifetimes get to the core of what rust is and what problems the borrow checker is there to solve. basically what the borrow checker does is it makes sure every object or value doesn't outlive its owner. every block of code in rust is scoped, and when you reach the end of that block, the value of that expression is returned and everything that's owned by that scope is deallocated. what you need to do is make sure that there's no possibility of you trying to use anything that already got destroyed in a previously executed block.

imagine this

code:
#[derive(Debug)]
struct rear end {
  data: &[u8;8]
}

fn farts() -> rear end {
  let butts = [1,2,3,4,5,6,7,8];
  rear end { data: &butts }
}

fn main() {
  println!("{:?}", farts());
}
uh oh, our rear end is only storing a reference to butts, but butts went out of scope when farts() finished executing and was deallocated. easy way to fix this is by making rear end actually own its own data instead of a reference to data owned by something else:

code:
#[derive(Debug)]
struct rear end {
  data: [u8;8]
}

fn farts() -> rear end {
  let butts = [1,2,3,4,5,6,7,8];
  rear end { data: butts.clone() }
}

fn main() {
  println!("{:?}", farts());
}
note that im pretty sure rust will implicitly call clone() here if you don't write it anyway

another way to fix it, if we don't want to be evil and waste precious bytes of memory by copying stuff is to prove that the data which is referenced will outlive our rear end. this is where lifetimes come in.

code:
#[derive(Debug)]
struct rear end<'a> {
  data: &'a [u8;8]
}

fn farts<'a>() -> rear end<'a> {
  let butts = [1,2,3,4,5,6,7,8];
  rear end { data: &butts }
}

fn main() {
  println!("{:?}", farts());
}
but this doesnt quite work, because although we added lifetimes, rust's borrow checker notices that we're claiming that our data should outlive our rear end, but we're still referencing that local variable butts that's going out of scope, so our assertion that butts will outlive our rear end is clearly false. here's how i'd fix that:

code:
#[derive(Debug)]
struct rear end<'a> {
  data: &'a [u8;8]
}

fn farts<'a>(butts: &'a [u8;8]) -> rear end<'a> {
  rear end { data: butts }
}

fn main() {
  let butts = [1,2,3,4,5,6,7,8];
  println!("{:?}", farts(&butts));
}
that works. butts is now created outside of the local function call, and the reference to it is passed into the function. it's still owned by the main function scope, which will outlive our farts call. now we've proved that our rear end isn't referencing anything thats already deallocated

does that make any sense to you?

Ciaphas
Nov 20, 2005

> BEWARE, COWARD :ovr:


Thank you for going into so much detail, I just wasn't getting the right mental hints from reading the rust book :D that all makes a lot more sense - especially if I say to myself "would doing this potentially gently caress me over in c++? if so the compiler will complain instead of me finding out later"


The core of my actual confusion, I think, is move vs copy semantics and when they're necessary - which in this case probably means I'm overthinking optimization. At the same time I want to do things as idiomatically as possible while I'm learning the language, so I'll ask more newbie questions

- CANPacket::_data's contents can be 1 to 8 bytes inclusive, and it shouldn't be mutable after construction if possible. What type do i probably want to store in the struct: an array or vec or something else? (I assume not a slice, for the lifetime reasons discussed - but see below)
- CANPacket is heavily used (CAN is broadcast network and there are some dozen addresses broadcasting all the time on these devices) but I don't know how heavy, if that makes sense. How hard is optimizing stuff like this later, do I have to architect this in advance to get it right or what? said devices are very weak on CPU and RAM, so unfortunately I really DO have to think about this :(
- However I actually store the bytes (or a reference to them), I want new() to be able to take one-to-eight bytes from any dang where without particularly caring whether it's an array, vec, slice or something else. At this level I don't even care if they're memory-contiguous, optimization aside. Given all that, what's the idiomatic way to spec that function parameter?

Ciaphas fucked around with this message at 13:54 on Jul 13, 2020

gonadic io
Feb 16, 2011

>>=
Given that it really is just 1-8 bytes the way that is most idiomatic is to just copy the memory. If you want to own a variable length array then a Vec is an array on the heap but in this case you probably want a SmallVec which is a variable length array that's on the stack (usually) and is owned.

code:
use smallvec::SmallVec;

struct Butt {
    // the nice variable length array is backed by a [u8; 8] until it overflows
    data: SmallVec<[u8; 8]> 
}
impl Butt {
    pub fn new(buff: &[u8]) -> Butt {
        Butt {
            data: SmallVec::from_slice(buff)
        }
    }
}
Although it also depends on how you're obtaining those bytes - if you have e.g. a serial library that has you filling a mutable buffer, you might want to e.g. reuse that buffer in the packet reading loop so you copy out of it to a Butt so you have a copy anyway and this is probably the best approach.

Slices are the most flexible input type, you can turn an array, vec, whatever into one just by doing &vec[..]

Ciaphas
Nov 20, 2005

> BEWARE, COWARD :ovr:


thanks! I'll be reading/writing all of my non-unit-test data from/to sockets - specifically crate socketcan::CANSocket::read_frame() - if that changes anything

Ciaphas fucked around with this message at 14:11 on Jul 13, 2020

galenanorth
May 19, 2016

I could create a website where people play board games against each other, only via webcam, instead of an electronic version. I don't have any money to pay people, so I'd use a site currency where people get 1000 points to spend on games, they can earn points by setting up a board game in front of a webcam and moving around pieces for two other people, and rich people can buy more of the in-game currency instead of earning them by running/refereeing board games

gonadic io
Feb 16, 2011

>>=
Okay the CANFrame struct already copies the data out of the socket and stores it as a [u8; 8] which it exposes to you as a &[u8] when you want to look at it (since not all 8 bytes might be valid). So you can just pass that around maybe.

gonadic io
Feb 16, 2011

>>=

galenanorth posted:

I could create a website where people play board games against each other, only via webcam, instead of an electronic version. I don't have any money to pay people, so I'd use a site currency where people get 1000 points to spend on games, they can earn points by setting up a board game in front of a webcam and moving around pieces for two other people, and rich people can buy more of the in-game currency instead of earning them by running/refereeing board games

What does this thing have over skype? You're hiring somebody to set up the board/move the pieces? What?

galenanorth
May 19, 2016

Maybe if it were an online gambling site, but those are banned in the U.S. Otherwise it'd just be Omegle for board games, but I don't think that Omegle makes any money. The site currency part would only be useful for games where one side can't know what the other is doing, like Battleship, but no one's going to pay for that.

I'll think of something else

galenanorth fucked around with this message at 14:45 on Jul 13, 2020

Ciaphas
Nov 20, 2005

> BEWARE, COWARD :ovr:


gonadic io posted:

Okay the CANFrame struct already copies the data out of the socket and stores it as a [u8; 8] which it exposes to you as a &[u8] when you want to look at it (since not all 8 bytes might be valid). So you can just pass that around maybe.

y'know what it took me a shower just now to realize? why am I copying the fields out of CANFrame instead of just... saving the CANFrame itself as a field? :doh:

programming is hard and at times I am not quick on the uptake :eng99:

gonadic io
Feb 16, 2011

>>=

Ciaphas posted:

y'know what it took me a shower just now to realize? why am I copying the fields out of CANFrame instead of just... saving the CANFrame itself as a field? :doh:

programming is hard and at times I am not quick on the uptake :eng99:

It was a good learning experience nonetheless!

Ciaphas
Nov 20, 2005

> BEWARE, COWARD :ovr:


it was! i need to ease up on the self-deprecating in jest or otherwise, not doin me any favors :newlol:

fart simpson
Jul 2, 2005

DEATH TO AMERICA
:xickos:

Ciaphas posted:

it was! i need to ease up on the self-deprecating in jest or otherwise, not doin me any favors :newlol:

now u know rust

Progressive JPEG
Feb 19, 2003

fart simpson posted:

easy way to fix this is by making rear end actually own its own data instead of a reference to data owned by something else:

code:
#[derive(Debug)]
struct rear end {
  data: [u8;8]
}

fn farts() -> rear end {
  let butts = [1,2,3,4,5,6,7,8];
  rear end { data: butts.clone() }
}

fn main() {
  println!("{:?}", farts());
}
note that im pretty sure rust will implicitly call clone() here if you don't write it anyway

i think if you omit the clone() here then butts will be moved rather than copied

but that's only a valid strategy in cases like that example, where farts() doesn't try to interact with butts after it's been moved

for example this will fail to compile:

code:
fn farts() -> rear end {
  let butts = [1,2,3,4,5,6,7,8];
  let rear end = rear end { data: butts };
  println!("{}", butts); // FAIL: reference of butts after move to rear end
  rear end
}
see also Ownership and moves

fart simpson
Jul 2, 2005

DEATH TO AMERICA
:xickos:

oh yeah you’re right. i thought i might be forgetting something there

MononcQc
May 29, 2007

terrible programming: FAIL: reference of butts after move to rear end

galenanorth
May 19, 2016

some ideas already in my rejects pile

- Selling customized packages of non-perishable food such as custom trial-sized packages, the whole single-color M&M's thing but with companies that don't do that yet. All else being equal, I'd prefer to start with an idea that doesn't involve physical products so that the money being risked is minimized.
- TiVo for radio as an online app was in my June 2018 list, but Radio.com did it a year later.
- Automatic local lottery statistics analysis. A website selling a PC program for this appears to have recently gone out of business. It seems too niche to be worth it

- Quiz site - When I wrote this is in 2016, small-time quiz site Playbuzz had secured $15 million for sneaking ads into its quizzes, and I think that ship has sailed by now

- Deathogram, a website for dead man's switch content and actions (e.g. email sending) - All else being equal, I wouldn't want to do this one even if it worked out

- Website with a better UI than the one https://www.congress.gov and https://www.senate.gov or third-party sites provide. Include an asterisk when the member voted differently in committee than in the floor vote, because "moderates" tend to switch sides because floor votes are more visible. Sort by Yea+Not Voting or Nay+Not Voting and by political party simultaneously. Use the Congressional Record to automatically splice together C-SPAN clips while allowing the user to tweak start and end times. Those are some features I'd like to see. I guess the only revenue would be from donations, and I don't want to try to make money from donations anyway

Edit: I have a web scraping project that involves scraped data and competing with https://www.aggata.com and other sites which sell CSVs. I've been using WordPress to make the site. If I can't think of another app, I think switching to Django and React will suffice to check off "has a project written in Django and React" for job searching purposes. I'll also probably need to do it in order to leave open the possibility of custom widgets like embedded Google Maps showing the data and allowing customers to file custom orders of data (e.g. competing coffee shops in Arkansas).

galenanorth fucked around with this message at 16:07 on Jul 13, 2020

Progressive JPEG
Feb 19, 2003

tbh the move-by-default thing is like my fav part of rust and if you're able to structure things to take advantage of it you can quickly end up with safe code that also has almost no malloc overhead

Adbot
ADBOT LOVES YOU

bob dobbs is dead
Oct 8, 2017

I love peeps
Nap Ghost

galenanorth posted:

some ideas already in my rejects pile

- Selling customized packages of non-perishable food such as custom trial-sized packages, the whole single-color M&M's thing but with companies that don't do that yet. All else being equal, I'd prefer to start with an idea that doesn't involve physical products so that the money being risked is minimized.
- TiVo for radio as an online app was in my June 2018 list, but Radio.com did it a year later.
- Automatic local lottery statistics analysis. A website selling a PC program for this appears to have recently gone out of business. It seems too niche to be worth it

- Quiz site - When I wrote this is in 2016, small-time quiz site Playbuzz had secured $15 million for sneaking ads into its quizzes, and I think that ship has sailed by now

- Deathogram, a website for dead man's switch content and actions (e.g. email sending) - All else being equal, I wouldn't want to do this one even if it worked out

- Website with a better UI than the one https://www.congress.gov and https://www.senate.gov or third-party sites provide. Include an asterisk when the member voted differently in committee than in the floor vote, because "moderates" tend to switch sides because floor votes are more visible. Sort by Yea+Not Voting or Nay+Not Voting and by political party simultaneously. Use the Congressional Record to automatically splice together C-SPAN clips while allowing the user to tweak start and end times. Those are some features I'd like to see. I guess the only revenue would be from donations, and I don't want to try to make money from donations anyway

Edit: I have a web scraping project that involves scraped data and competing with https://www.aggata.com and other sites which sell CSVs. I've been using WordPress to make the site. If I can't think of another app, I think switching to Django and React will suffice to check off "has a project written in Django and React" for job searching purposes. I'll also probably need to do it in order to leave open the possibility of custom widgets like embedded Google Maps showing the data and allowing customers to file custom orders of data (e.g. competing coffee shops in Arkansas).

all these ideas would involve selling to peeps who, to a first approximation, dont have any fuckin money to solve their problems

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