Briefly, this works very nicely when $Y$ is locally compact, but not otherwise.
Then the function space carries the compact-open topology.

John Isbell gave a survey of the story and literature in his paper
*General Function Spaces, Products and Continuous Lattices*,
in Math Proc Cam Phil Soc **100** (1986) 193--205.

It is an ongoing matter in theoretical computer science.

There is frequent and ongoing literature on this subject going back to
when Ralph Fox introduced the compact-open topology in
*On Topologies for Function-Spaces* in Bull AMS **51** (1945).

It was originally considered in homotopy theory,
then in category theory and topological lattice theory.
After that theoretical computer science took over,
under the headings of domain theory, realisability
and "exact" real computation.

Along the way some very important concepts have been identified,
in particular the **universal property** of the **exponential** in
a **cartesian closed category** (as stated elsewhere on this page)
but also that of a **continuous lattice**.

Briefly, a distributive continuous lattice is exactly the topology
of a locally compact space.

I say this primarily as a warning to those (students in particular)
who may think that a little bit of tweeking of the category or
the universal property might yield better results.
There are a lot of *broken* ideas along the way,
some of which you will find surveyed in Isbell's paper.
Breaking a *correct* idea like the universal property
(by restricting its test object to a single space) is not going to help.

The most important topological space is not the real interval but the
Sierpinski space, for which I write $\Sigma$.
Classically, it has open open and one closed point.
It is important because there are (constructive) bijections amongst

- continuous functions $\phi:X\to\Sigma$,
- open subspaces $U\subset X$ and
- closed subspaces $C\subset X$.

In particular, putting $Y\equiv\Sigma$ in the desired universal
property, a continuous map $\phi:\Gamma\times X\to\Sigma$
is an open subspace of $\Gamma\times X$
and you want that to correspond to a continuous function $\Gamma\to\Sigma^X$.

With $\Gamma\equiv{\bf 1}$, this means that the points of $\Sigma^X$
must be the open subspaces of $X$.

With $\Gamma\equiv\Sigma^X$, we want the transpose of $id:\Sigma^X\to\Sigma^X$
to be continuous, but this is $ev:\Sigma^X\times X\to\Sigma$ defined
by $ev(U,x)\equiv(x\in U)$.
This map defines an open subspace of $\Sigma^X\times X$,
which is a union of rectangles ${\cal V}\times V$.
If $x\in U$ then $(U,x)\in{\cal V}\times V$ and $x\in V\subset K\subset U$
where $K\equiv\bigcap{\cal V}$ is compact.

So this works exactly when $X$ is locally compact and $\Sigma^X$
is its lattice of open subspaces, itself equipped with the
**Scott topology**, which has a basis consisting of
${\cal V}\equiv\lbrace W|K\subset W\rbrace$ for $K$ compact.

I forget why $K$ is compact, but a good place to look would
be the paper
*Local Compactness and Continuous Lattices*
by Karl Hofmann and Mike Mislove
in Springer Lecture Notes in Mathematics **871** (1981) 209-248.
It was in this paper that the **interpolation property**
$x\in V\subset K\subset U$ was introduced
as the **definition of a locally compact space** that is (sober but)
not necessarily Hausdorff.

So this is the reason why local compactness of $X$ is necessary.

If $X$ is locally compact then the exponentials $Y^X$ exist for *all*
spaces $Y$.
However, even when $Y$ is locally compact, $Y^X$ need not be,
for example **Baire space** $N^N$ is not,
so locally compact spaces do not form a cartesian closed category.
Nevertheless, $\Sigma^X$ is always locally compact when $X$ is.

Of course the argument for necessity above does not work
if you only allow $\Gamma\equiv[0,1]$ in the universal property.
However, it is not a good idea to mess around with such definitions.

If you seriously want to use the collection of maps $X\to Y$
as another space then you require a notation and a way of computing
with **functions as first-class objects**.
This notation is called the (typed) **lambda calculus**.

When the universal property of the exponential was recognised
in the 1960s, it was not only related to this question in general topology
but also to the formulation of symbolic logic,
that is, to the lambda calculus and to **proof theory**.

I always write $\Gamma$ for the test object of a universal property
because it plays exactly the same role in category theory
as the **context** does in symbolic logic,
which is customarily written with this letter.
The context of an expression is the list of parameters (free variables)
in it and their types (the spaces over which they range).

If you restrict $\Gamma$ to be just the singleton or interval
then you cannot have general parameters in your expressions.

Dana Scott initially got involved in this subject because he wanted
to show that the *untyped* lambda calculus is meaningless.
However, he fairly quickly discovered models of it,
in the form of topological lattices such that $X\cong X^X$.
See, for example, his
*Data Types as Lattices* in
the SIAM Journal on Computing **5** (1976) 522-587.

Out of this grew veritable industries called **domain theory**
and **denotational semantics**.
In the 1980s, cartesian closed categories of domains came two-a-penny
(I was responsible for some of them), where
"domains" were particular kinds of partial orders
equipped with the Scott topology.
Denotational semantics used these to give mathematical
meanings to constructs in programming languages
in order to demonstrate the correctness of programs.

If you do not like the story for the whole of the traditional category
of topological spaces then there are many alternatives.

The "official" answer in homotopy theory was
the (full sub)category of **compactly generated spaces**.

On the other hand, there are ways of enlarging the traditional
category to make it cartesian closed.
*Equilogical Spaces and Filter Spaces* by Pino Rosolini
in Rendiconti del Circolo Matematico di Palermo **64** (2000) 157--175
gives an excellent survey of them,
explaining how they are reflctive subcategories of
presheaves on the traditional category.
In particular, Scott had introduced **equilogical spaces**,
defined as topological spaces equipped with formal equivalence relations;
the theory is set out in full in
*Equilogical Spaces*
by Andrej Bauer, Lars Birkedal and Dana Scott.

Having gone to the trouble of writing this lengthy account
of (some of) the history of this question,
I would like to turn it back on the homotopy theorists.

When topics like this were considered by categorists in the 1960s,
they aimed their papers at (for example) topologists.
Therefore they did not spell out the topology, because their
intended readers would know it.
This is very frustrating for subsequent students of category theory:
the papers just contain the category theory and it is impossible
to trace back to the preceding mathematical ideas.

So I would be grateful if the homotopy theorists here would explain,
without rehearsing the category theory,
what the motivations were and are in their own subject
for asking for "convenient" or cartesian closed categories.