In Charlie and the Chocolate Factory, Roald Dahl offered a glimpse of the confectionery so many of us would all love to taste - from rivers of chocolate to everlasting gobstoppers, a sweet that not only changes colour and flavour but never gets any smaller.
The perfect chocolate bar or chewing gum that never loses flavour are the ultimate goals of the food industry and now, thanks to technology able to analyse food in new ways, makers may have a chance of producing them.
Snacking giant Mondelez - behind brands such as Cadburys, Oreo and Kenco - has just installed an artificial nose at its UK research headquarters that it hopes can sniff out some new ways to create products, perhaps making them a little more Willy Wonka-ish along the way.
The machine, based at Reading in Berkshire, has a pretty sophisticated sense of smell, able to identify the compounds that make up different foodstuffs - in the case of chocolate, about 40.
"We have always been able to measure the compounds but this is the first time that we've been able to analyse how they interact with each other in real time," explained Alex Webbe, senior group leader at Mondelez international global science and technology research centre.
So when the artificial nose is given some chocolate to smell, it is able to pick out two key compounds - a cheesy note not usually associated with chocolate, alongside the more traditional cocoa flavour.
The progress of the compounds as they are put through an artificially created eating process can be monitored via a computer readout, offering a kind of digital signature for the chocolate.
Scientists can see how the water-soluble "cheesy" flavour dies off when the chocolate is chewed, giving way to the more familiar cocoa flavour.
So what does this real-time view of chocolate tell us about this popular favourite guilty pleasure?
One thing it suggests is that chocolate is probably best enjoyed "at ambient temperature", said Mr Webbe.
But it isn't just about taste. "Some people like the texture of chocolate straight out of the fridge."
The artificial nose is also being used to analyse the flavours in chewing gum and work out why they come to an end, perhaps even suggesting ways that it can keep flavour for longer.
Smell has long been a key ingredient in creating successful food.
Electronic noses that mimic the way the human nose smells have been around since the 1950s and are widely used in the food industry to identify ways to improve taste.
According to Barry Smith, founder of the centre for the study of the senses at the University of London, up to 80% of the flavours we taste come from what we smell.
And there is a simple test to prove this.
"Pinch your nose and eat a jelly bean and you won't be able to detect the flavour," he said.
That is because the taste buds can identify only about seven flavours - including sweet, sour, bitter and salt and umami (savoury). The rest are distinguished by smell.
Making sure that a product smells right is a key part of creating food that people want to eat and the industry employs all kinds of tricks to get it right.
Take apart a teabag, for instance, and you may notice tiny white specks inside - flavour balls, created to enhance that typical tea smell.
Having an artificial nose, able to distinguish all the many aroma compounds that make up food, might seem like a great idea but Prof Smith is not so sure.
"An artificial nose can only go so far," he said
"It can't tell how flavours combine with the tastes in our mouths which will have an impact on overall flavour. We also don't know how the brain processes that information and treats it to give us a flavour experience," he said.
The human nose does seem to be drawn to nasty smells.
"Jasmine in nature is made up of about 3% indole, an unpleasant-smelling compound. When perfumiers recreate jasmine scent they do it without that but in tests we are more likely to prefer the natural smell.
"It suggests that we like a little bit of pain with our pleasure."
Smell is not always the best indicator of how something will taste either.
"Smelly cheese may smell like a teenager's training shoe but when you put it in your month it tastes lovely," said Prof Smith.
For him any smelling machine would have to be used only alongside a human tasting panel to identify the best tastes. The art of the master blender will remain a necessary skill, he thinks.
"Technology still can't do better than that," he said.
Mondelez said that its "nose" would indeed be used in conjunction with its sensory tasting team - a panel of trained tasters who provide vital human insight into how changes to the make-up of food will be perceived.
Such individuals are hard to find - last year the firm interviewed 100 potential panellists and only four made it through.
Getting the taste of food right is crucial as consumers demand ever more sophisticated products.
In January when Cadbury's announced that its Creme Eggs would no longer be made from Cadbury Dairy Milk but from a standard cocoa mix chocolate, there was an angry reaction from fans.
"What have you done to the Cadbury Creme Egg? I know Americans don't get chocolate but urgh it's horrid," was a typical reaction on Twitter.
And the food industry is under increasing pressure to make products that are more healthy.
The artificial nose can identify the amounts of fatty compounds and also suggest how many of these can be removed without affecting the taste.
Data analysis of the compounds that make up food is offering new insights into why we like one particular food or drink over another.
Researchers in France who analysed some particularly well-regarded pinot noir wine, using a method known as gas chromatography mass spectrometry, recently made a surprising discovery.
"They found that there was a beauty in the shape of the data, like finding something in nature with a beautiful geometric form," said Prof Smith.
"The idea that the foods we rate as elegant, hedonistically pleasurable, may have complex physical signatures at the digital level that are also beautiful is really exciting," he said.