ANIMAL: Tentacled Snake Erpeton tentaculatum Type of Animal: Colubrid Habitat: Stagnant/slow-moving murky water w/ emergent-submergent vegetation in lakes, rice paddies/fields, streams, canals, & ponds, prefers fresh/brackish water but sometimes found in saltwater, almost always in slightly acidic, shallow areas Location(s): Thailand, Cambodia, & Vietnam Appearance: 2 color phases: striped/blotched-both range from dark grey or brown to light tan, named for twin “tentacles” on front of head, trapezoid shaped head, prehensile tail Food/Diet: Fish & tadpoles Status in Wild: Stable Conservation: Breeding from zoos, aquariums, & private breeders. Lifestyle: Usually found in groups of 4-7 Additional Info: Called: Male Female Young-Snakelet Group-Nest/Den Weight: Adult-4.93-7 oz Young-1 oz Gestation: 1 month Life Span: 10-20 years Body Length: 1.67-2.5 ft Tail Length: 5-7.5 in Main predators are crocodilians, larger snakes, monitor lizards, wading birds, fishing cats, otters, & tigers. They’re ambush predators & often lie in wait together, attaching to weeds/underwater roots w/ tails. Often lie in “J” position. Spend their entire life in water & never come to land. They give birth to 5-15 live young underwater. They’re active at night (nocturnal). Sometimes kept as pets. Discovered by Western science in 1800’s. Sometimes considered pests due to frequent visits to fish farms. Fun Fact(s): “Tentacles” can be used to “see” in dark. “Tentacles” actually mechanoreceptors that detect prey movement. They’ll retract their eyes when they begin their strike. They can be great escape artists & they can die after only a few hours on dry land. They can spend 30 minutes submerged before returning to surface to refill lungs. While they’re mildly venomous, fangs are small, only partially grooved, & deep in the rear of mouth. It is specific for fish & tadpoles they eat. They’re very docile snakes, though they’re very sensitive & don’t like handling.
No non-trivial destructors When performing a tail-name
we need to have the ability to free the current stack-frame before calling the goal function and
this requires the lifetime of all stack-allotted objects to have ended previous to the decision.
So we see that coroutines performing a symmetric-switch generally
fulfill all of the necessities for being able to perform a tail-call.
However, coroutines have been marketed as a zero
value abstraction and there have even been people using coroutines to
suspend execution of a function to avoid ready for
an L1-cache-miss (see Gor’s nice CppCon talk on nanocoroutines for extra details on this).
However, with the revised model that uses atomics it’s potential that consume() might both be executed
on a thread associated with the scheduler, s, or on no matter thread the patron() coroutine began execution on. In case your application solely ever executes on a single thread
then you’re paying the price of the atomic operations for synchronising
threads although it’s by no means needed. Typically its implementation comprises a single ret instruction.
Calling convention When the compiler lowers a coroutine
into machine code it actually splits the coroutine up into
two components: the ramp (which allocates and initialises the coroutine frame) and the body (which comprises the state-machine for
the user-authored coroutine physique).